A method, device, storage medium and equipment based on cluster deployment service
By using multi-level configuration data structures and inheritance relationships in cluster deployment services, the problem of configuration file management under multiple clusters and multiple services is solved, and efficient configuration management and deployment is achieved.
Patent Information
- Application Number
- CN202111660254.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-31
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2041-12-31
AI Technical Summary
When different services are deployed in multiple different small clusters, it is difficult for the prior art to effectively manage and maintain a large number of configuration files, resulting in heavy maintenance and error-prone.
Using a multi-level configuration data structure, through the inheritance relationship between the parent node and the child node, the configuration items for each service are sorted out and complete configuration information specifically for each cluster is generated.
It reduces the amount of configuration information that the corresponding nodes of each cluster need to store, improves data maintenance efficiency and correctness, and reduces the redundancy and complexity of configuration files.
Smart Images

Figure CN114489720B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer software deployment, and in particular to a method, apparatus, storage medium and device based on cluster deployment service. Background Art
[0002] When deploying services in a private cloud built for a small cluster of an enterprise or institution, on the one hand, the product service needs to be deployed offline in each private cloud so that the service provides independent services for it and ensures that private data will not be leaked outside the private cloud; on the other hand, due to the large differences in clusters of various enterprises and institutions, it is impossible to use a unified service configuration for deployment. At this time, a set of configuration files containing all configuration information is usually provided for each service of each cluster to adapt to the various differences of different clusters.
[0003] However, as the number of services that need to be deployed and the number of clusters to which the services need to be deployed continue to grow, the number of configuration files that need to be created and maintained will increase exponentially. In particular, when updating some common basic configuration items, it is necessary to modify the configuration files of each service in each cluster one by one, making the maintenance work extremely cumbersome and prone to errors. Summary of the invention
[0004] In order to solve the above-mentioned problems existing in deploying different services in multiple different small clusters, the embodiments of the present application creatively provide a method, apparatus, storage medium and device method, apparatus and computer-readable storage medium for cluster-based deployment of services.
[0005] According to a first aspect of an embodiment of the present application, a method for cluster-based deployment of services is provided, the method comprising: obtaining multi-level configuration data of a first service for different clusters, the multi-level configuration data comprising nodes of at least two levels of hierarchical structure, the relationship between the upper and lower nodes being an inheritance relationship between a parent node and a child node, the multi-level configuration data comprising at least two configuration items, wherein a configuration item set for each child node overrides a corresponding configuration item of a parent node, a configuration item not set for each child node inherits a corresponding configuration item of a parent node, and a configuration item of a corresponding cluster is set at a last-level node; according to the multi-level configuration data, determining all configuration items of the first service for the first cluster to obtain first configuration data; and according to the first configuration data, deploying the first service to the first cluster.
[0006] According to an embodiment of the present application, the method further includes: creating multi-level configuration data for different clusters for the first service to obtain first multi-level configuration data.
[0007] According to an embodiment of the present application, the method also includes: storing the first multi-level configuration data in a first configuration library corresponding to the first service; accordingly, obtaining the multi-level configuration data of the first service for different clusters includes: obtaining the multi-level configuration data of the first service for different clusters from the first configuration library.
[0008] According to an embodiment of the present application, all configuration items of the first service for the first cluster are determined according to the multi-level configuration data to obtain the first configuration data, including: according to the multi-level configuration data, obtaining the configuration items stored in the first-level node to obtain the second configuration data; according to the first cluster, determining the first path from the first-level node to the node corresponding to the first cluster; obtaining the configuration items of each node on the first path in turn, and according to the configuration items of each node, overwriting the corresponding data items in the second configuration data to obtain the first configuration data.
[0009] According to an embodiment of the present application, determining a first path from a first-level node to a node corresponding to the first cluster according to the first cluster includes: determining a first path from a first-level node to a node corresponding to the first cluster in an order from a last-level node to a first-level node according to the first cluster.
[0010] According to an embodiment of the present application, the method further includes: determining the node where the configuration item to be updated is located in the multi-level configuration data to obtain a first node; and updating the corresponding configuration item on the first node according to the configuration item to be updated.
[0011] According to an embodiment of the present application, the multi-level configuration data also includes nodes for different scenarios, and accordingly, the final-level node is provided with configuration items of the corresponding cluster in the corresponding scenario; accordingly, according to the multi-level configuration data, all configuration items of the first service for the first cluster are determined to obtain the first configuration data, including: according to the multi-level configuration data, all configuration items of the first service for the first cluster in the first scenario are determined to obtain the first configuration data.
[0012] According to the second aspect of the embodiment of the present application, a device based on cluster deployment service is also provided, which includes: a multi-level configuration data acquisition module, used to obtain multi-level configuration data of a first service for different clusters, the multi-level configuration data includes nodes of at least two levels of hierarchical structure, and the relationship between the upper and lower nodes is the inheritance relationship between the parent node and the child node. The multi-level configuration data includes at least two configuration items, wherein the configuration item set for each child node covers the corresponding configuration item of the parent node, and the configuration item not set for each child node inherits the corresponding configuration item of the parent node, and the last-level node is set with the configuration item of the corresponding cluster; a cluster configuration data determination module, used to determine all configuration items of the first service for the first cluster according to the multi-level configuration data to obtain first configuration data; a service deployment module, used to deploy the first service to the first cluster according to the first configuration data.
[0013] According to the third aspect of the embodiment of the present application, a system based on cluster deployment service is also provided, the system includes a code repository, a deployment center and at least one cluster, wherein the code repository is used to store multi-level configuration data of the first service for different clusters, the multi-level configuration data includes nodes of at least two levels of hierarchical structure, and the relationship between the upper and lower nodes is an inheritance relationship between the parent node and the child node, wherein the configuration items set for each child node override the corresponding configuration items of the parent node, the configuration items not set for each child node inherit the corresponding configuration items of the parent node, and the last-level node is set with the configuration items of the corresponding cluster; the deployment center is used to execute any of the above-mentioned methods based on cluster deployment services to deploy the first service to a cluster in at least one cluster.
[0014] According to the fourth aspect of the embodiment of the present application, a computer device is also provided, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the program, any of the above-mentioned methods for cluster-based deployment of services is implemented.
[0015] According to a fifth aspect of an embodiment of the present application, there is also provided a computer-readable storage medium on which a computer program is stored, characterized in that when the program is executed by a processor, any of the above-mentioned methods for cluster-based deployment of services is implemented.
[0016] The embodiment of the present application provides a method, device, storage medium and equipment for cluster-based deployment of services. The method organizes the configuration of each service for different clusters into multi-level configuration data, wherein the multi-level configuration data includes nodes of at least two hierarchical structures, and the relationship between the upper and lower nodes is the inheritance relationship between the parent node and the child node. The multi-level configuration data includes at least two configuration items, and the configuration items set for each child node cover the corresponding configuration items of the parent node. The configuration items not set for each child node inherit the corresponding configuration items of the parent node, and the last-level node is provided with the configuration items of the corresponding cluster. When it is necessary to deploy each service to a specific cluster, a set of complete configuration information specifically for the cluster can be generated according to the inheritance relationship between the multi-level configuration data and the configuration items. In this way, in the node corresponding to each cluster, only the configuration information specific to the node needs to be stored, and other common configuration information can be inherited from the parent node, which greatly reduces the amount of data maintenance and makes it easier to ensure the correctness of the data.
[0017] It should be understood that the teachings of the present application are not required to achieve all of the above beneficial effects, but specific technical solutions can achieve specific technical effects, and other embodiments of the present application can also achieve beneficial effects not mentioned above. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present application will become readily understood. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-limiting manner, wherein:
[0019] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.
[0020] Figure 1 A schematic diagram of the implementation flow of a method for implementing a cluster-based deployment service according to an embodiment of the present application;
[0021] Figure 2 This is a schematic diagram of the structure of multi-level configuration data according to an embodiment of the present application;
[0022] Figure 3 A schematic diagram of a process for creating multi-level configuration data according to an embodiment of the present application;
[0023] Figure 4 A schematic diagram of the implementation flow of a method for implementing cluster-based deployment services according to another embodiment of the present application;
[0024] Figure 5 A schematic diagram of the implementation flow of a method for implementing cluster-based deployment services according to another embodiment of the present application;
[0025] Figure 6 A schematic diagram of the composition structure of an apparatus based on cluster deployment services in an embodiment of the present application. DETAILED DESCRIPTION
[0026] The principles and spirit of the present application will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present application, and are not intended to limit the scope of the present application in any way. On the contrary, these embodiments are provided to make the present application more thorough and complete, and to fully convey the scope of the present application to those skilled in the art.
[0027] The technical solution of the present application is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0028] Figure 1 The main process of implementing a method for cluster-based deployment services according to an embodiment of the present application is shown. Figure 1The method for cluster deployment service in an embodiment of the present application at least includes the following operation flow: operation 110, obtaining multi-level configuration data of the first service for different clusters, the multi-level configuration data including at least two configuration items, the multi-level configuration data including at least two-level hierarchical nodes, the relationship between the upper and lower nodes is the inheritance relationship between the parent node and the child node, wherein the configuration item set for each child node covers the corresponding configuration item of the parent node, the configuration item not set for each child node inherits the corresponding configuration item of the parent node, and the last-level node is set with the configuration item of the corresponding cluster; operation 120, determining all configuration items of the first service for the first cluster according to the multi-level configuration data, and obtaining the first configuration data; operation 130, deploying the first service to the first cluster according to the first configuration data.
[0029] In operation 110, the first service is a network application service that provides specific functions through an application program or other forms, such as an authentication service, a clock-in service, a conference service, and the like.
[0030] A cluster, also known as a cluster server, refers to a server architecture that combines the resources of multiple servers to provide highly available, efficient computing and efficient storage. When deploying the first service, the cluster can be regarded as a single server.
[0031] In the embodiment of the present application, the first service may be applicable to different clusters, but the multiple clusters to be deployed for the first service usually have different computing capabilities, the number of servers constituting each cluster is different, and the hardware conditions of each server are also different.
[0032] Therefore, when deploying the first service to different clusters, different deployment parameters are specified, such as the maximum number of running instances, the maximum capacity of content planning, etc., due to the different scales (number of servers constituting each cluster) and computing capabilities of each cluster. In this way, the computing capabilities of each cluster are fully utilized, and the first service is set to achieve better running performance when running in different clusters.
[0033] In view of the above situation, an embodiment of the present application uses multi-level configuration data to set the multi-level configuration data of the first service for different clusters. The multi-level configuration data includes at least two configuration items, and each configuration item is a key-value pair of deployment parameters and their values that need to be specified to deploy the first service, for example, "instances": 1 (representing the maximum number of running instances is 1). The multi-level configuration data includes nodes of at least two levels of hierarchical structure, and the relationship between the upper and lower nodes is the inheritance relationship between the parent node and the child node, wherein the configuration items set for each child node override the corresponding configuration items of the parent node, and the configuration items not set for each child node inherit the corresponding configuration items of the parent node, and the last-level node is set with the configuration items of the corresponding cluster, wherein the last-level node refers to a node without child nodes.
[0034] Figure 2 The structure of multi-level configuration data of the first service for different clusters in the embodiment of the present application is shown. Figure 2 The multi-level configuration data may adopt a tree structure, which includes nodes of a four-level hierarchical structure: a root node 20; a cluster type node (e.g., cluster type 201 and cluster type 202); a cluster subtype node (e.g., cluster subtype 2011, cluster subtype 2012); a cluster node (e.g., cluster 2021, cluster 2022, cluster 20111, cluster 20112, cluster 20121, and cluster 20122). Cluster 2021 has no cluster subtype, and its child nodes may be clusters.
[0035] Among them, the root node 20 is a first-level node, that is, a node without a parent node; the cluster type node is a second-level node, that is, a child node of the first-level node; the cluster sub-type node is a third-level node, that is, a child node of the second-level node; the cluster node is the last-level node and is also a leaf node of the tree structure.
[0036] The configuration items of the root node 20 may be set to all deployment parameters and their default values required for deploying the first service, or may be set to deployment parameters and common values applicable to most clusters.
[0037] The cluster type node is provided with configuration items that distinguish the corresponding cluster type from other cluster types, and these configuration items are also common configuration items that are generally applicable to each cluster subtype within the corresponding cluster type.
[0038] The cluster subtype node is provided with configuration items that distinguish the corresponding cluster subtype from other cluster subtypes, and these configuration items are common configuration items that are generally applicable to each cluster within the corresponding cluster subtype.
[0039] The cluster nodes are set with configuration items that distinguish the corresponding cluster from other clusters.
[0040] In this way, the common configuration items of each child node in this level can be placed in the parent node of the previous level, and each child node in this level only needs to place the configuration items that are different from other child nodes. When the common configuration items need to be modified, only the configuration items in the parent node need to be modified, and each child node can naturally inherit the modified common configuration items. In this way, redundant data between each child node can be removed to the greatest extent, and the amount of data maintenance can be greatly reduced.
[0041] When obtaining the multi-level configuration data of the first service for different clusters, it can be directly obtained from the data storage system that stores the multi-level configuration data. This method can reduce the real-time processing time and respond faster. It is also possible to obtain the required data from the data storage system that stores data such as each node of the multi-level configuration data, the configuration data items corresponding to each node, and the inheritance relationship of each node, and generate the multi-level configuration data for different clusters in real time. This method places lower requirements on the data storage system.
[0042] In operation 120 , the first configuration data refers to all configuration items of the first service for the first cluster, that is, all deployment parameters and their values required to deploy the first service to the first cluster.
[0043] As described above, the first cluster usually corresponds to a leaf node, and the first configuration data can be determined according to the configuration items set on the leaf node, the configuration items set on the parent node, and the configuration items set on the ancestor nodes at all levels obtained recursively.
[0044] by Figure 2 Taking the multi-level configuration data shown in FIG. 1 as an example, all configuration items of the first service for the first cluster are determined according to the multi-level configuration data to obtain the first configuration data, which can be obtained by Figure 3 The process shown is implemented, which mainly includes:
[0045] Step 310, acquiring the configuration items stored in the root node according to the multi-level configuration data to obtain second configuration data;
[0046] Step 320: determining a first path from the root node to a node corresponding to the first cluster according to the first cluster;
[0047] Assuming that the first cluster is cluster 2021 , the first path is a path from the root node 20 to the cluster 2021 : root node 20 - cluster type 202 - cluster 2021 .
[0048] Step 330: sequentially obtain configuration items of each node on the first path, and overwrite corresponding data items in the second configuration data according to the configuration items of each node to obtain first configuration data.
[0049] In this process, the configuration items set for each child node overwrite the corresponding configuration items of the parent node, and the configuration items not set for each child node inherit the corresponding configuration items of the parent node. After the configuration items of the leaf nodes are processed in order from the root node to the leaf node, all the configuration items of the cluster corresponding to the leaf node (i.e., the first cluster) will be obtained.
[0050] After the first configuration data is determined, all deployment parameters required to deploy the first service to the first cluster for application in the first scenario are determined, and the first service can be deployed to the first cluster through operation 130 .
[0051] It can be seen that the cluster-based deployment service method provided in the embodiment of the present application organizes the configuration of each service for different clusters into multi-level configuration data, wherein the multi-level configuration data includes nodes of at least two levels of hierarchical structure, and the relationship between the upper and lower nodes is the inheritance relationship between the parent node and the child node. The multi-level configuration data includes at least two configuration items, and the configuration item set by each child node covers the corresponding configuration item of the parent node. The configuration item not set by each child node inherits the corresponding configuration item of the parent node, and the leaf node is provided with the configuration item of the corresponding cluster. When it is necessary to deploy each service to a specific cluster, a set of complete configuration information specifically for the cluster can be generated according to the inheritance relationship between the multi-level configuration data and the configuration items. In this way, in the node corresponding to each cluster, only the configuration information specific to the node needs to be stored, and other common configuration information can be inherited from the parent node, which greatly reduces the amount of data maintenance and makes it easier to ensure the correctness of the data.
[0052] In the embodiment of the present application, the above multi-level configuration data is pre-created through the following process:
[0053] Create a root node and set all deployment parameters and their default values required by the first service, or deployment parameters and common values applicable to most clusters, as configuration items of the root node;
[0054] Under the root node, create a cluster type node and set the configuration items that distinguish the cluster type from other cluster types as the configuration items of the corresponding cluster type node. If there is no cluster type node, create a cluster node directly.
[0055] Under the cluster type node, create a cluster subtype node and set the configuration items that distinguish the cluster subtype from other cluster subtypes as the configuration items of the corresponding cluster subtype node. If there is no cluster subtype, create a cluster node directly.
[0056] Under the cluster subtype node, create a cluster node and set the configuration items that distinguish the cluster from other clusters as the configuration items of the corresponding cluster node.
[0057] In this way, multi-level configuration data of the first service for different clusters can be obtained.
[0058] After the multi-level configuration data is created, it can also be stored in the configuration library. In this way, when obtaining the multi-level configuration data of the first service for different clusters, it can be directly obtained from the configuration library.
[0059] If the value of a specific common configuration item in a specific hierarchical structure needs to be modified, it can be updated through the following process: determine the node where the configuration item to be updated is located in the multi-level configuration data to obtain the first node; based on the configuration item to be updated, update the corresponding configuration item on the first node.
[0060] Among them, when determining the node where the configuration item to be updated is located in the multi-level configuration data, the multi-level configuration data can be queried through keywords to find the configuration items that match it and the nodes where the matching configuration items are located; the node where the configuration item to be updated is located in the multi-level configuration data can also be determined according to the specified node path.
[0061] In this way, when some common configuration items change, there is no need to modify the configuration items in each cluster configuration data, but only the configuration items in the corresponding nodes.
[0062] Figure 4 Another embodiment of the present application shows a method for implementing a cluster-based deployment service. Figure 4 In the embodiment of the present application shown, a code repository is used as a configuration library, and the code repository stores multi-level configuration data of multiple services for different clusters, such as service 1, service 2, and service 3, etc.; the deployment center is responsible for obtaining the configuration data required for each deployment and building a complete deployment configuration; in one deployment, multiple services can be deployed together to a specified cluster.
[0063] In an embodiment of the present application, in order to facilitate the management of multi-level configuration data of each service, a separate code library is created for each service in the code repository, such as service 1 code library, service 2 code library, and service 3 code library.
[0064] After creating multi-level configuration data for different clusters for each service, the multi-level configuration data corresponding to each service will be stored in the code base corresponding to the corresponding service. For example, the tree-like configuration structure corresponding to service 1 is stored in the service 1 code base; the tree-like configuration structure corresponding to service 2 is stored in the service 2 code base; the tree-like configuration structure corresponding to service 3 is stored in the service 3 code base. In this way, it is convenient to manage the multi-level configuration data of each service separately, avoiding interference between the multi-level configuration data of each service, especially when these multi-level configuration data are maintained by different developers or business departments, this implementation method also facilitates data isolation and permission management.
[0065] In addition, storing the multi-level configuration data corresponding to each service in the code library corresponding to the corresponding service is also conducive to quickly locating the multi-level configuration data corresponding to the corresponding service. Compared with storing the multi-level configuration data of all services in the same code library, the operation of querying the multi-level configuration data is also faster.
[0066] Assuming that this deployment is to deploy service 1, service 2, and service 3 on cluster X, after receiving the corresponding deployment instructions, the deployment center will obtain the deployment configuration of the corresponding service for cluster X from the code base. For example, the deployment configuration of service 1 for cluster X is obtained from the service 1 code base; the deployment configuration of service 2 for cluster X is obtained from the service 2 code base; and the deployment configuration of service 3 for cluster X is obtained from the service 3 code base.
[0067] Then, the deployment configurations of the above services 1, 2, and 3 for cluster X are merged to obtain the complete configuration information of this deployment.
[0068] Subsequently, service 1 is deployed on cluster X according to the deployment configuration of service 1 for cluster X; service 2 is deployed on cluster X according to the deployment configuration of service 2 for cluster X; and service 3 is deployed on cluster X according to the deployment configuration of service 3 for cluster X.
[0069] In this process, the acquisition of deployment configurations of different services for cluster X can be performed in parallel; the process of deploying corresponding services on cluster X according to the deployment configuration of each service for cluster X can also be performed in parallel. In this way, efficient deployment of multiple services can be achieved.
[0070] Figure 5 The tree configuration structure of another embodiment of the present application is shown. In the embodiment of the present application, the first service will be applied to different scenarios. In a specific scenario, even if the scale and computing power of each cluster are different, the specific deployment parameters will be set to the same value. For example, in a test scenario, in order to ensure the normal operation of all functions of the user in the basic application scenario and provide a positioning basis for other problems, the running instance is usually limited to 1 to eliminate problems caused by multiple instances.
[0071] To this end, the multi-level configuration data in the embodiment of the present application also includes nodes for different scenarios, for example, "test customized configuration" for the test scenario. Accordingly, the leaf node is provided with the configuration items of the corresponding cluster in the corresponding scenario, such as the cluster A test configuration. Accordingly, when all configuration items of the first service for the first cluster are determined according to the multi-level configuration data to obtain the first configuration data, it includes: determining all configuration items of the first service for the first cluster in the first scenario according to the multi-level configuration data to obtain the first configuration data.
[0072] Assume that the deployment parameters required to deploy the first service to the cluster include "cpus", "mem", "instances" and "task_concurrency"; the clusters available for deployment include: "Cluster A", "Cluster B" and "Cluster C"; the applied scenarios include test scenarios or production scenarios. The multi-level configuration data of the first service for different clusters and different application scenarios includes nodes of a three-level hierarchical structure: a root configuration node (e.g., a basic complete configuration), an application scenario node (e.g., a test customized configuration and a production customized configuration) and cluster configuration nodes in corresponding scenarios (e.g., cluster A test configuration, cluster B test configuration, cluster A production configuration and cluster C production configuration).
[0073] Assuming that the first cluster to be deployed is "Cluster A" and the application scenario to be deployed is "Test Scenario", you can obtain the configuration items on the "Basic Complete Configuration" - "Test Custom Configuration" - "Cluster A Test Configuration" nodes one by one, so that the configuration items set on each child node overwrite the corresponding configuration items of the parent node, and the unconfigured configuration items of each child node inherit the corresponding configuration items of the parent node, and you can get all the deployment parameters required to deploy the first service to Cluster A and apply it to the test scenario.
[0074] For example, to obtain the basic complete configuration: "cpus": 0.4; "mem": 4096; "instances": 1.
[0075] After that, get the configuration of "Test Custom Configuration". Since "Test Custom Configuration" does not set any configuration, it inherits all basic complete configurations.
[0076] Then, obtain the configuration data of the "Cluster A Test Configuration" node, and use the task_concurrency": "6"; "cpus": 0.8 set on the node to overwrite the "task_concurrency" and "cpus" in the basic complete configuration, and you can get all the deployment parameters required to deploy the first service to cluster A for the test scenario: "cpus": 0.8; "mem": 4096; "instances": 1; "task_concurrency": "6".
[0077] After obtaining the above configuration data, the first service can be deployed to the first cluster so that the first service can be applied to the test scenario.
[0078] The cluster deployment service-based method provided by the embodiment of the present application can not only determine deployment parameters based on the cluster, but also obtain deployment parameters of different clusters in different application scenarios in combination with various application scenarios, which has a wider scope of application.
[0079] It should be noted that the above multi-level configuration data can be implemented by any applicable tree data structure, especially the inheritance tree data structure provided by some programming languages. In implementing each operation in the above method, any applicable traversal, recursion and query algorithm based on tree data structure can also be used as long as the corresponding function can be achieved.
[0080] Similarly, based on the above method for cluster-based service deployment, the present application embodiment also provides a device for cluster-based service deployment, such as Figure 6 As shown, the device 60 includes: a multi-level configuration data acquisition module 601, which is used to obtain multi-level configuration data of the first service for different clusters, the multi-level configuration data includes nodes of at least two levels of hierarchical structure, the relationship between the upper and lower nodes is the inheritance relationship between the parent node and the child node, the multi-level configuration data includes at least two configuration items, wherein the configuration item set for each child node covers the corresponding configuration item of the parent node, the configuration item not set for each child node inherits the corresponding configuration item of the parent node, and the last-level node is set with the configuration item of the corresponding cluster; a cluster configuration data determination module 602, which is used to determine all configuration items of the first service for the first cluster according to the multi-level configuration data to obtain the first configuration data; a service deployment module 603, which is used to deploy the first service to the first cluster according to the first configuration data.
[0081] According to an embodiment of the present application, the device 60 further includes: a multi-level configuration data creation module, configured to create multi-level configuration data for different clusters for the first service, and obtain first multi-level configuration data.
[0082] According to an embodiment of the present application, the device 60 also includes: a multi-level configuration data storage module, which is used to store the first multi-level configuration data in a first configuration library corresponding to the first service; accordingly, the multi-level configuration data acquisition module 601 is specifically used to obtain the multi-level configuration data of the first service for different clusters from the first configuration library.
[0083] According to an embodiment of the present application, the cluster configuration data determination module 602 includes: a first-level node configuration acquisition module, which is used to obtain the configuration items stored in the first-level node according to the multi-level configuration data, and obtain the second configuration data; a cluster path determination module, which is used to determine the first path from the first-level node to the node corresponding to the first cluster according to the first cluster; a configuration item overwriting module, which is used to obtain the configuration items of each node on the first path in turn, and overwrite the corresponding data items in the second configuration data according to the configuration items of each node to obtain the first configuration data.
[0084] According to an embodiment of the present application, the cluster path determination module is specifically used to determine, according to the first cluster, a first path from the first-level node to a node corresponding to the first cluster in the order from the last-level node to the first-level node.
[0085] According to an embodiment of the present application, the device 60 also includes: a node determination module to be updated, used to determine the node where the configuration item to be updated is located in the multi-level configuration data, and obtain the first node; a configuration item updating module, used to update the corresponding configuration item on the first node according to the configuration item to be updated.
[0086] According to an embodiment of the present application, the multi-level configuration data also includes nodes for different scenarios. Accordingly, the final-level node is provided with configuration items of the corresponding cluster in the corresponding scenario; accordingly, the cluster configuration data determination module 602 is specifically used to determine all configuration items of the first service for the first cluster in the first scenario according to the multi-level configuration data, and obtain the first configuration data.
[0087] Similarly, based on the cluster-based deployment service method, the present application embodiment also provides a cluster-based deployment service system, such as Figure 4 As shown, the system includes a code repository, a deployment center and at least one cluster (cluster X), wherein the code repository is used to store multi-level configuration data of the first service (for example, service 1, service 2 and service 3) for different clusters, and the multi-level configuration data includes nodes of at least two levels of hierarchical structure, and the relationship between the upper and lower nodes is the inheritance relationship between the parent node and the child node, wherein the configuration items set for each child node override the corresponding configuration items of the parent node, and the configuration items not set for each child node inherit the corresponding configuration items of the parent node, and the last-level node is set with the configuration items of the corresponding cluster; the deployment center is used to execute any of the above-mentioned methods based on cluster deployment services to deploy the first service to a cluster (cluster X) in at least one cluster.
[0088] Similarly, based on the cluster-based deployment service method, an embodiment of the present application also provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the program, it implements any of the above-mentioned cluster-based deployment service methods.
[0089] Similarly, based on the cluster-based deployment service method, an embodiment of the present application also provides a computer-readable storage medium, which stores a program. When the program is executed by a processor, the processor executes at least any of the above-mentioned cluster-based deployment service methods.
[0090] It should be pointed out here that the above description of the device embodiment based on cluster deployment service, the above description of the computer device embodiment and the above description of the computer readable storage medium embodiment are similar to the description of the aforementioned method embodiment and have similar beneficial effects as the method embodiment, so they will not be repeated. For technical details not disclosed in the display device embodiment of the configuration information of this application, please refer to the description of the aforementioned method embodiment of this application for understanding, and in order to save space, they will not be repeated.
[0091] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0092] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0093] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0094] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0095] A person skilled in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, etc., various media that can store program codes.
[0096] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can essentially or in other words, the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods of each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0097] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for cluster-based deployment services, characterized in that: The method comprises: Obtain multi-level configuration data of the first service for different clusters, wherein the multi-level configuration data includes at least two configuration items, and the multi-level configuration data includes nodes of at least two hierarchical structures, wherein the relationship between the upper and lower nodes is an inheritance relationship between a parent node and a child node, wherein the parent node is used to place common configuration items, and the child node is used to place configuration items that are different from other child nodes, and the configuration items set for each child node cover the corresponding configuration items of the parent node, and the configuration items not set for each child node inherit the corresponding configuration items of the parent node, and the last-level node is set with the configuration items of the corresponding cluster; Determine, according to the multi-level configuration data, all configuration items of the first service for the first cluster, and obtain first configuration data; Deploy the first service to the first cluster according to the first configuration data.
2. The method according to claim 1, characterized in that The method further comprises: Multi-level configuration data for different clusters is created for the first service to obtain first multi-level configuration data.
3. The method according to claim 2, characterized in that The method further comprises: Storing the first multi-level configuration data in a first configuration repository corresponding to the first service; Accordingly, obtaining multi-level configuration data of the first service for different clusters includes: From the first configuration library, multi-level configuration data of the first service for different clusters is obtained.
4. The method according to claim 1, characterized in that: The determining, according to the multi-level configuration data, all configuration items of the first service for the first cluster to obtain first configuration data includes: According to the multi-level configuration data, obtain the configuration items stored in the first-level node to obtain the second configuration data; Determine, according to the first cluster, a first path from the first-level node to a node corresponding to the first cluster; The configuration items of each node on the first path are obtained in sequence, and the corresponding data items in the second configuration data are overwritten according to the configuration items of each node to obtain the first configuration data.
5. The method according to claim 4, characterized in that The determining, according to the first cluster, a first path from the first-level node to a node corresponding to the first cluster includes: According to the first cluster, a first path from the first-level node to a node corresponding to the first cluster is determined in the order of a final-level node to a first-level node.
6. The method according to claim 1, characterized in that The method further comprises: Determine the node where the configuration item to be updated is located in the multi-level configuration data, and obtain a first node; According to the configuration item to be updated, the corresponding configuration item on the first node is updated.
7. The method according to claim 1, characterized in that The multi-level configuration data also includes nodes for different scenarios. Accordingly, the final node is provided with configuration items of the corresponding cluster in the corresponding scenario; Accordingly, according to the multi-level configuration data, all configuration items of the first service for the first cluster are determined to obtain first configuration data, including: According to the multi-level configuration data, all configuration items of the first service for the first cluster in the first scenario are determined to obtain first configuration data.
8. A device for cluster deployment service, characterized in that: The device comprises: A multi-level configuration data acquisition module, used to acquire multi-level configuration data of the first service for different clusters, wherein the multi-level configuration data includes nodes of at least two levels of hierarchical structure, and the relationship between the upper and lower nodes is the inheritance relationship between the parent node and the child node, and the multi-level configuration data includes at least two configuration items, wherein the parent node is used to place common configuration items, and the child node is used to place configuration items different from other child nodes, and the configuration items set for each child node cover the corresponding configuration items of the parent node, and the configuration items not set for each child node inherit the corresponding configuration items of the parent node, and the last-level node is set with the configuration items of the corresponding cluster; A cluster configuration data determination module, configured to determine all configuration items of the first service for the first cluster according to the multi-level configuration data, and obtain first configuration data; A service deployment module is used to deploy the first service to the first cluster according to the first configuration data.
9. A system based on cluster deployment service, the system comprising a code repository, a deployment center and at least one cluster, characterized in that: in, The code repository is used to store multi-level configuration data of the first service for different clusters, wherein the multi-level configuration data includes nodes of at least two levels of hierarchical structure, wherein the relationship between the upper and lower nodes is an inheritance relationship between a parent node and a child node, wherein the parent node is used to place common configuration items, and the child node is used to place configuration items different from other child nodes, wherein the configuration items set for each child node override the corresponding configuration items of the parent node, and the configuration items not set for each child node inherit the corresponding configuration items of the parent node, and the last-level node is provided with configuration items of the corresponding cluster; The deployment center is used to execute the method described in any one of claims 1 to 7 to deploy the first service to one of the at least one cluster.
10. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 7 when executing the program.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Control configuration updating method and system and electronic equipment
CN113485767A