Platform cluster deployment method, device, system and computer readable storage medium
By generating format files and task files and using the target container to automatically start the cluster, the problem of time-consuming manual operations in large-scale cluster deployment is solved, intelligent and fast cluster deployment is achieved, and human resource waste and environment recovery time are reduced.
Patent Information
- Application Number
- CN202011644104.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-30
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2040-12-30
AI Technical Summary
When deploying large-scale clusters, existing technologies require manual operations that are time-consuming and waste human resources. Frequent cluster reconstruction in unstable environments causes operations and maintenance personnel to repeat work. Existing methods are not intelligent enough and cannot quickly implement cluster deployment.
By determining the environment information of the target cluster, generating a format file, and generating a task file based on the target container and the format file, the target container is used to automatically start the cluster, integrate the environment information into the format file, generate a task file, and execute the task to start the cluster.
It achieves intelligent and rapid deployment of clusters, reduces waste of human resources, improves environmental recovery efficiency, and ensures the reliability and rapid startup of clusters in unstable environments.
Smart Images

Figure CN112685135B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of research and development process optimization, and particularly relates to a platform cluster deployment method, device, system and computer readable storage medium. BACKGROUND
[0002] Microservices, as a new technology for deploying applications and services in the cloud, has become the latest hot topic and the development trend of software in the IT industry. Through deployment of clusters, enterprises no longer have to use a series of open source software to build a container service platform from scratch.
[0003] Currently, more and more enterprises use open source clusters such as rancher as a platform for managing cloud services, and the cluster platform deployment method is simple. When the number of cluster hosts is small, a manual command line deployment method can be used for deployment in daily work. However, when the number of cluster hosts is large, the manual filling of cluster hosts not only lengthens the environment recovery time, but also wastes valuable human resources, especially in unstable development environments. Since the development environment is always in the debugging stage, the current framework may be cleared and rebuilt. If the manual method is still used, it will lead to the continuous investment of operation and maintenance personnel in repetitive and low-value labor, and each deployment of a cluster needs to be built from scratch. Obviously, the existing cluster deployment method is not intelligent enough and cannot be quickly and simply implemented. SUMMARY
[0004] The main purpose of the present application is to provide a platform cluster deployment method, device, system and computer readable storage medium, which aims to quickly realize intelligent deployment of platform clusters.
[0005] To achieve the above purpose, the present application provides a platform cluster deployment method, which comprises the following steps:
[0006] determining the environment information of a target cluster, and generating a format file of the target cluster based on the environment information;
[0007] generating a task file corresponding to the target cluster based on a target container corresponding to the target cluster and the format file;
[0008] starting the target cluster based on the target container and the task file.
[0009] Optionally, the step of starting the target cluster based on the target container and the task file comprises:
[0010] determining whether the target container and the target cluster establish a trust relationship, wherein if a public key of a cluster server of the target cluster exists in a cluster host of the target cluster, it is determined that the target container and the target cluster establish a trust relationship;
[0011] If yes, the target cluster is started based on the target container and the task file.
[0012] Optionally, the step of starting the target cluster based on the target container and the task file comprises:
[0013] obtaining an image file of a cluster server of the target cluster based on the target container and the task file, and starting the cluster server based on the image file;
[0014] starting a cluster host of the target cluster based on the cluster server.
[0015] Optionally, before the step of starting the cluster host of the target cluster based on the cluster server, the platform cluster deployment method further comprises:
[0016] detecting whether the cluster server is successfully started;
[0017] If not, a first error information is issued, and the image file of the cluster server is re-obtained based on the target container and the task file, and the step of starting the cluster server is executed.
[0018] Optionally, after the step of starting the target cluster based on the target container and the task file, the platform cluster deployment method further comprises:
[0019] determining a target stack ID corresponding to the target cluster, and determining a service state of the target cluster based on the target stack ID;
[0020] If the service state is unhealthy, a second error information is issued.
[0021] Optionally, the step of determining the environment information of the target cluster, and generating a format file of the target cluster based on the environment information comprises:
[0022] determining the environment information of the target cluster based on a running environment of the target cluster, and determining a file format corresponding to the target cluster based on a target container corresponding to the target cluster;
[0023] generating a corresponding format file of the environment information according to the file format.
[0024] Optionally, the generating the task file corresponding to the target cluster based on the target container corresponding to the target cluster and the format file comprises:
[0025] determining a mounting point of the format file in the target container corresponding to the target cluster, and mounting the format file at the mounting point;
[0026] generating the task file corresponding to the target cluster based on a file template in the target container.
[0027] In addition, to achieve the above object, the present application also provides a platform cluster deployment device, which comprises:
[0028] a first generating module configured to determine environment information of a target cluster, and generate a format file of the target cluster based on the environment information;
[0029] a second generating module configured to generate a task file corresponding to the target cluster based on a target container corresponding to the target cluster and the format file;
[0030] a starting module configured to start the target cluster based on the target container and the task file.
[0031] Optionally, the starting module is further configured to:
[0032] determine whether the target container and the target cluster establish a trust relationship, wherein if a public key of a cluster server of the target cluster exists in a cluster host of the target cluster, it is determined that the target container and the target cluster establish a trust relationship;
[0033] if yes, start the target cluster based on the target container and the task file.
[0034] Optionally, the starting module is further configured to:
[0035] obtain an image file of the cluster server of the target cluster based on the target container and the task file, and start the cluster server based on the image file;
[0036] start a cluster host of the target cluster based on the cluster server.
[0037] Optionally, the platform cluster deployment device further comprises a detecting module, and the detecting module is further configured to:
[0038] detect whether the cluster server is successfully started;
[0039] If the operation is not successful, a first error message is sent, and based on the target container and the task file, the image file of the cluster server is reacquired, and the step of starting the cluster server is executed.
[0040] Optionally, the detection module is further configured to:
[0041] determine a target stack ID corresponding to the target cluster, and determine a service state of the target cluster based on the target stack ID;
[0042] If the service state is unhealthy, a second error message is sent.
[0043] Optionally, the first generation module is further configured to:
[0044] determine environment information of the target cluster based on a running environment of the target cluster, and determine a file format corresponding to the target cluster based on a target container corresponding to the target cluster;
[0045] generate a corresponding format file of the environment information according to the file format.
[0046] Optionally, the second generation module is further configured to:
[0047] determine a mounting point of the target container corresponding to the format file, and mount the format file under the mounting point;
[0048] generate a task file corresponding to the target cluster in the target container based on a file template in the target container.
[0049] In addition, to achieve the above object, the present application also provides a platform cluster deployment system, which comprises a processor, a memory, and a platform cluster deployment program stored in the memory and executable by the processor, wherein the platform cluster deployment program is executed by the processor to realize the steps of the platform cluster deployment method as described above.
[0050] In addition, to achieve the above object, the present application also provides a computer readable storage medium, which stores a platform cluster deployment program, wherein the platform cluster deployment program is executed by a processor to realize the steps of the platform cluster deployment method as described above.
[0051] The application provides a platform cluster deployment method, environment information of a target cluster is determined, and a format file of the target cluster is generated based on the environment information; a task file corresponding to the target cluster is generated based on a target container corresponding to the target cluster and the format file; and the target cluster is started based on the target container and the task file. The application uses a target container to realize automatic deployment of a platform cluster, integrates environment information of a cluster into a format file, generates a task file of the cluster based on a target container and the format file, that is, a series of tasks for starting the cluster are constructed into a task file, and the cluster can be started by executing tasks in the task file, thereby realizing intelligent deployment of the cluster quickly. BRIEF DESCRIPTION OF DRAWINGS
[0052] Figure 1 A hardware structure diagram of a platform cluster deployment system involved in an embodiment of the application is shown in the figure.
[0053] Figure 2 A flowchart of a platform cluster deployment method according to a first embodiment of the application is shown in the figure.
[0054] Figure 3 A functional module diagram of a platform cluster deployment device according to a first embodiment of the application is shown in the figure.
[0055] The implementation, functional features and advantages of the application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION
[0056] It should be understood that the specific embodiments described herein are merely intended to explain the application and are not intended to limit the application.
[0057] The platform cluster deployment method involved in the embodiments of the application is mainly applied to a platform cluster deployment system, which can include a PC, a portable computer, a mobile terminal and other devices with display and processing functions.
[0058] REFERENCE Figure 1 , Figure 1Fig. 1 is a schematic diagram of a hardware structure of a platform cluster deployment system according to an embodiment of the present application. The platform cluster deployment system can include a processor 1001 (such as a CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to realize the connection and communication among the components; the user interface 1003 can include a display and an input unit such as a keyboard; the network interface 1004 can optionally include a standard wired interface and a wireless interface (such as a WI-FI interface); the memory 1005 can be a high-speed RAM memory, a stable memory (such as a disk memory), and can optionally be a storage device independent of the processor 1001.
[0059] Those skilled in the art can understand that the hardware structure shown in Fig. 1 does not constitute a limitation on the platform cluster deployment system, and can include more or fewer components, or combine certain components, or different component arrangements. Figure 1
[0060] With reference to Fig. 1, the memory 1005 as a computer readable storage medium can include an operating system, a network communication module, and a platform cluster deployment program. Figure 1 Figure 1 The network communication module is mainly used to connect a server and communicate data with the server; the processor 1001 can call the platform cluster deployment program stored in the memory 1005 and execute the platform cluster deployment method provided by the embodiment of the present application.
[0061] In the embodiment, the network communication module is mainly used to connect a server and communicate data with the server; the processor 1001 can call the platform cluster deployment program stored in the memory 1005 and execute the platform cluster deployment method provided by the embodiment of the present application. Figure 1 The embodiment of the present application provides a platform cluster deployment method.
[0062] With reference to Fig. 1, the memory 1005 as a computer readable storage medium can include an operating system, a network communication module, and a platform cluster deployment program.
[0063] Figure 2 Fig. 2 is a flowchart of a platform cluster deployment method according to a first embodiment of the present application. Figure 2 The platform cluster deployment method includes the following steps:
[0064] Step S10: determining environment information of a target cluster, and generating a format file of the target cluster based on the environment information;
[0065] Step S20: generating a task file corresponding to the target cluster based on a target container corresponding to the target cluster and the format file;
[0066]
[0067] Step S30, based on the target container and the task file, starting the target cluster.
[0068] The platform cluster deployment method of the embodiment is applied to a platform cluster deployment system, which is referred to as a deployment system for the sake of convenience.
[0069] The embodiment is to construct a series of tasks for starting a cluster into a task file, and then execute the tasks in the task file based on a container, so as to start the cluster. In the process, in order to enable a task created once to run at an arbitrary address, the environment information of a cluster that is not used needs to be integrated into different configuration files, that is, format files, and then the format files are mounted in the container. Then, based on the container and the format files, the task file of the cluster is generated, and subsequently, the cluster can be started only by executing the tasks in the task file.
[0070] The following will be a detailed description of each step:
[0071] Step S10, determining the environment information of the target cluster, and based on the environment information, generating the format file of the target cluster.
[0072] In the embodiment, the deployment system obtains the environment information of the target cluster, wherein the environment information includes the name of the cluster, the platform engine used, the cluster server information, the cluster host information, the domain name certificate of the cluster, the address of the container engine image library used by the cluster, and the like. Then, based on the environment information of the target cluster, the format file of the target cluster is generated, and specifically, these environment information is integrated into a format file.
[0073] Specifically, in an embodiment, step S10 includes:
[0074] Step a1, based on the running environment of the target cluster, determining the environment information of the target cluster, and based on the target container corresponding to the target cluster, determining the file format corresponding to the target cluster;
[0075] In an embodiment, the environment information of the target cluster is determined through the running environment of the target cluster, wherein the running environment includes a development environment, a production environment, a test environment, and the like. Different running environments correspond to different environment information. For example, the environment information corresponding to the development environment is a cluster server list, a user of the server, a domain name used by the cluster, an image warehouse address used by the cluster, and the like. The environment information required by the running environment can be associated in advance, that is, a running environment-environment information mapping table is established in advance. When the running environment of the target cluster is determined, the corresponding environment information can be determined by looking up the mapping table.
[0076] Then, based on the target container corresponding to the target cluster, a file format corresponding to the target cluster is determined. In this embodiment, the target container can be an ansible container. It should be noted that determining the file format corresponding to the target cluster is actually determining the file format supported by the target container, that is, when deploying the cluster, the format file corresponding to the cluster can be determined according to the file format supported by the target container adopted, for example, the target cluster is a rancher cluster, and the target container adopted is an ansible container, and then it is determined that the file format corresponding to the target cluster is a json format, because the ansible container supports the json format, that is, the environment information needs to be integrated into a json file in the subsequent step, so that the lookup plug-in of the ansible container can be used to read the format file in the subsequent step.
[0077] In step a2, the environment information is generated into a corresponding format file according to the file format.
[0078] In an embodiment, after the environment information of the target cluster and the corresponding file format are determined, the deployment system generates the environment information into a corresponding format file according to the determined file format, that is, the environment information is integrated into a corresponding format file, and the specific integration method is to fill in the environment information according to the syntax of the file format, therefore, the syntax rule corresponding to the file format of the target cluster needs to be determined, and then the environment information is integrated into a format file according to the determined syntax rule, for example, in the above example, the ansible container is used, and therefore the environment information of the target cluster needs to be integrated into a json file, and then the json syntax needs to be filled in, that is, after the file format corresponding to the environment information is determined, for example, json, the environment information can be generated into a json file according to the json syntax.
[0079] In step S20, based on the target container corresponding to the target cluster and the format file, a task file corresponding to the target cluster is generated.
[0080] In this embodiment, after the environment information of the target cluster is generated into a format file, the target container corresponding to the target cluster is started, and the target container is used to generate a task file corresponding to the target cluster based on the format file.
[0081] In an embodiment, the containers corresponding to different clusters can be different, and therefore, the target container corresponding to the target cluster needs to be determined, and the target container corresponding to the target cluster can be determined according to the identifier of the target cluster or the service information corresponding to the target cluster.
[0082] Further, in an embodiment, step S20 includes:
[0083] Step b1, determining a mounting point of the format file in the target container corresponding to the target cluster, and mounting the format file at the mounting point;
[0084] Step b2, based on a file template in the target container, generating a task file corresponding to the target cluster from the format file at the mounting point in the target container.
[0085] In an embodiment, in order to successfully generate the task file of the target cluster, the format file needs to be mounted into the target container to generate the task file through the target container. Therefore, the mounting point of the format file in the target container needs to be determined first, and then the format file is mounted at the mounting point of the target container.
[0086] Specifically, the directory of the format file is determined, and the directory is mounted at a root directory of the target container. Since the mounting operation will hide the original files in the directory, the mounting point is preferably an empty directory newly created in the target container. This is because the root directory and the original system directory as the mounting point may cause system abnormalities or even crashes. Therefore, the newly created empty directory is used as the mounting point of the directory of the format file in this embodiment.
[0087] Then, based on the pre-built file template in the target container and the determined format file, a task file for starting the target cluster is generated. For example, the pre-built file template in the ansible container is a jiaja2 file. In the ansible container, the template module in the ansible container is used to generate a yml file required by the ansibleplaybook (container script) from the format file according to the jiaja2 file, which is the task file.
[0088] Step S30, based on the target container and the task file, starting the target cluster.
[0089] In this embodiment, the deployment system starts the target cluster based on the target container and the task file. Specifically, the target cluster is started by executing the task file in the target container, such as executing a series of playbook files in the ansible container.
[0090] Further, in an embodiment, step S30 includes:
[0091] Step c1, based on the target container and the task file, obtaining an image file of a cluster server of the target cluster, and starting the cluster server based on the image file;
[0092] In an embodiment, based on the task file, the image file of the cluster server of the target cluster is obtained through the target container. Specifically, based on the task file, the image address of the target cluster is determined, the image repository is logged in through the target container according to the determined image address, the image file of the cluster server of the target cluster is obtained, and then the image file is run in the target container, so as to start the cluster server.
[0093] It should be emphasized that, in order to further ensure the privacy and security of the above-mentioned image file, the above-mentioned image file can be stored in a node of a block chain.
[0094] Step c2, based on the cluster server, starting the cluster host of the target cluster.
[0095] In an embodiment, the deployment system adds the cluster host through the cluster server, specifically adds the host information of the cluster host, such as the host number, IP address, etc. into the cluster server of the target cluster, and starts the cluster host after starting the cluster server.
[0096] That is, in an embodiment, starting the target cluster includes starting the cluster server of the target cluster and starting the cluster host of the target cluster, executing the task in the task file, that is, running the image file of the cluster server in the target container through the task file, so as to start the cluster server, and then adding the host information of the cluster host, so as to start the cluster host.
[0097] Further, before starting the cluster host, the platform cluster deployment method further comprises:
[0098] Step c3, detecting whether the cluster server is successfully started;
[0099] Step c4, if not successful, issuing a first error information, and based on the target container and the task file, re-obtaining the image file of the cluster server, and executing the step of starting the cluster server.
[0100] In an embodiment, in order to avoid that the service of the cluster host cannot be used, before starting the cluster host, it is necessary to first detect whether the cluster server is successfully started. Specifically, the deployment system connects the platform address, that is, the address of the cluster server, through the built-in python requests.Session module, and detects whether the connection is successful. If the connection is not successful within a predetermined time, the connection fails, otherwise the cluster server is successfully started.
[0101] If the connection fails, a first error information is issued to prompt the operation and maintenance personnel, and the corresponding error is repaired. The repair method includes automatic repair, and the automatic repair step is to log in the image repository address through the target container again, obtain the image file of the cluster server, and start.
[0102] The embodiment provides a platform cluster deployment method, environment information of a target cluster is determined, and a format file of the target cluster is generated based on the environment information; a task file corresponding to the target cluster is generated based on a target container corresponding to the target cluster and the format file; and the target cluster is started based on the target container and the task file. The application uses a target container to realize automatic deployment of a platform cluster, integrates environment information of a cluster into a format file, generates a task file of the cluster based on a target container and a format file, that is, a series of tasks for starting the cluster are constructed into a task file, and the cluster can be started by executing tasks in the task file, thereby realizing intelligent deployment of the cluster quickly.
[0103] Further, the second embodiment of the platform cluster deployment method is provided based on the first embodiment.
[0104] The second embodiment of the platform cluster deployment method is different from the first embodiment of the platform cluster deployment method in that step S30 comprises:
[0105] In step c5, it is determined whether the target container and the target cluster establish a trust relationship, wherein if a public key of a cluster server of the target cluster exists in a cluster host of the target cluster, it is determined that the target container and the target cluster establish a trust relationship.
[0106] In step c6, if yes, the target cluster is started based on the target container and the task file.
[0107] In the embodiment, when the target cluster is started through the target container, in order to ensure the safety of starting, it is necessary to first determine whether the target container and the target cluster establish a trust relationship, and the target cluster can be started through the target container and the task file only when it is determined that the trust relationship has been established.
[0108] The following will be described in detail:
[0109] In step c5, it is determined whether the target container and the target cluster establish a trust relationship, wherein if a public key of a cluster server of the target cluster exists in a cluster host of the target cluster, it is determined that the target container and the target cluster establish a trust relationship.
[0110] In the embodiment, it is first verified whether the target container and the target cluster establish a trust relationship, wherein the trust relationship between the target container and the target cluster comprises a trust relationship between the target container and a cluster server of the target cluster, and a trust relationship between the target container and a cluster host of the target cluster.
[0111] Specifically, it is determined whether the public key of the cluster server exists in the cluster host, if yes, it is determined that the target container and the target cluster establish a trust relationship, if not, it is determined that the target container and the target cluster do not establish a trust relationship.
[0112] It should be noted that if it is determined that the target container and the target cluster do not establish a trust relationship, a trust relationship between the target container and the target cluster is created, specifically, a trust relationship between the target container and the cluster server and a trust relationship between the target container and the cluster host are created. In a specific implementation, the usernames and passwords of the cluster server and the cluster host are defined in the format file, and the format file is mounted in the target container. Therefore, the target container can log in to copy the public key of the cluster server through the username and password, and store the public key on the cluster host. At this time, the trust relationship between the target container and the cluster server and the cluster host is determined to be established. Therefore, whether the trust relationship is established can be determined by determining whether the public key of the cluster server exists in the cluster host.
[0113] Step c6, if yes, starting the target cluster based on the target container and the task file.
[0114] In this embodiment, after the trust relationship between the target container and the target cluster is created, the task file is executed in the target container, and the target cluster can be started. Taking the ansible container as an example, after the trust relationship is established, a series of playbook files can be executed in the ansible container to start the target cluster.
[0115] In this embodiment, when starting the target cluster, it is necessary to determine whether the target container and the target cluster have established a trust relationship. After it is determined that the target container and the target cluster establish a trust relationship, the target container and the task file are used to start the target cluster, thereby improving the security of cluster deployment.
[0116] Further, a third embodiment of the platform cluster deployment method is provided based on the first and second embodiments.
[0117] The third embodiment of the platform cluster deployment method is different from the first and second embodiments of the platform cluster deployment method in that the platform cluster deployment method further comprises:
[0118] Step d, determining a target stack ID corresponding to the target cluster, and determining a service state of the target cluster based on the target stack ID;
[0119] Step e, if the service state is unhealthy, a second error information is sent out.
[0120] In this embodiment, in order to ensure the availability of the deployed cluster, the service state of the cluster also needs to be monitored. If the service state of the cluster is unhealthy, a second error information is sent out to prompt the operation and maintenance personnel to maintain it in time.
[0121] The following will be described in detail:
[0122] Step d, determining the target stack ID corresponding to the target cluster, and determining the service state of the target cluster based on the target stack ID.
[0123] In this embodiment, after starting the target cluster, it is also necessary to check whether the target cluster ipsec and network service (network service) are healthy, so as to judge the service state of the target cluster. Specifically, by the ID of the target container of the target cluster, the target container state is viewed, and taking the rancher cluster as an example, the stack server stacts (stack) related api is used, the stack ID (stack id) of the target stack with the stack name of ipsec and network-service is obtained by the built-in python requests.get ($rancherAPI) module; then the target stack ID obtained is used to obtain the service state by the rancher server services (cluster server services) related api and the built-in python requests.get ($rancherAPI) module, and the service state is the target container state, that is, the service state of the target cluster. The service state includes healthy and unhealthy, if healthy, it is determined that the target cluster deployment is completed.
[0124] Step e, if the service state is unhealthy, a second error information is sent out.
[0125] In this embodiment, if the service state of the target cluster is unhealthy, a second error information is sent out to prompt the operation and maintenance personnel to maintain it in time.
[0126] Further, if the target host of another cluster needs to be started, the path of the cluster corresponding to the target host is created, and the path is mounted to the target container.
[0127] For example, host A is a host in A cluster before, and now it is added to B cluster, then only the path of A cluster corresponding to host A needs to be determined, and when starting the target container corresponding to B cluster, these paths are mounted to the target container, so as to save the files in the target container on the host, such as log files. At the same time, in order to avoid the phenomenon of insufficient resources of A cluster, after host A joins B cluster, the resource information of host A in A cluster needs to be cleaned up, such as dockervolume (data volume, which can be understood as host, that is, the files or directories of host A on A resource, etc.), and then the start is similar to the above, which will not be repeated here. Therefore, the platform deployment method of the embodiment can achieve the effect of once creation and multiple running.
[0128] The embodiment further needs to monitor the service state of the cluster to ensure the availability of the deployed cluster. If the service state of the cluster is unhealthy, a second error information is sent to prompt an operation and maintenance personnel to maintain the cluster in time, thereby improving the availability of the platform cluster deployment.
[0129] In addition, the embodiment of the present application further provides a platform cluster deployment device.
[0130] Reference Figure 3 , Figure 3 The figure is a functional module schematic diagram of the first embodiment of the platform cluster deployment device of the present application.
[0131] In the embodiment, the platform cluster deployment device comprises:
[0132] The first generation module 10 is configured to determine the environment information of a target cluster, and generate a format file of the target cluster based on the environment information;
[0133] The second generation module 20 is configured to generate a task file corresponding to the target cluster based on a target container corresponding to the target cluster and the format file;
[0134] The starting module 30 is configured to start the target cluster based on the target container and the task file.
[0135] Optionally, the starting module is further configured to:
[0136] determine whether the target container and the target cluster establish a trust relationship, wherein if a public key of a cluster server of the target cluster exists in a cluster host of the target cluster, it is determined that the target container and the target cluster establish a trust relationship;
[0137] If yes, the target cluster is started based on the target container and the task file.
[0138] Optionally, the starting module is further configured to:
[0139] based on the target container and the task file, obtain an image file of the cluster server of the target cluster, and start the cluster server based on the image file;
[0140] based on the cluster server, start a cluster host of the target cluster.
[0141] Optionally, the platform cluster deployment device further comprises a detection module, and the detection module is further configured to:
[0142] detect whether the cluster server is successfully started;
[0143] If not successful, a first error message is sent, and based on the target container and the task file, the image file of the cluster server is re-acquired, and the step of starting the cluster server is executed.
[0144] Optionally, the detection module is further configured to:
[0145] determine a target stack ID corresponding to the target cluster, and determine a service state of the target cluster based on the target stack ID.
[0146] If the service state is unhealthy, a second error message is sent.
[0147] Optionally, the first generation module is further configured to:
[0148] determine environment information of the target cluster based on a running environment of the target cluster, and determine a file format corresponding to the target cluster based on a target container corresponding to the target cluster.
[0149] generate a corresponding format file from the environment information according to the file format.
[0150] Optionally, the second generation module is further configured to:
[0151] determine a mounting point of the target container corresponding to the format file, and mount the format file under the mounting point.
[0152] generate a task file corresponding to the target cluster from the format file under the mounting point in the target container based on a file template in the target container.
[0153] Corresponding to each step in the above platform cluster deployment method embodiments, each module and unit in the above platform cluster deployment apparatus has the functions and implementation processes which will not be repeated here.
[0154] In addition, the embodiment of the present application further provides a computer readable storage medium.
[0155] The computer readable storage medium of the present application stores a platform cluster deployment program, wherein when the platform cluster deployment program is executed by a processor, the steps of the platform cluster deployment method as described above are realized.
[0156] The method realized when the platform cluster deployment program is executed can refer to each embodiment of the platform cluster deployment method of the present application, and will not be repeated here.
[0157] The blockchain referred to in the present application is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithm. The blockchain is essentially a decentralized database, and is a series of data blocks associated using cryptographic methods, each of which contains information of a batch of network transactions, for verifying the validity (anti-fake) of the information and generating the next block. The blockchain can include a blockchain underlying platform, a platform product service layer, and an application service layer, etc.
[0158] It should be noted that in this document, the terms "comprising", "containing" or any other variant thereof are intended to cover non-exclusive inclusions, so that a process, method, article or system including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or includes elements inherent to such a process, method, article or system. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of another identical element in the process, method, article or system including the element.
[0159] The above-mentioned embodiment numbers of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0160] From the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be realized by means of software and necessary general hardware platforms, of course, they can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application or 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 (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions to make a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) execute the methods described in various embodiments of the present application.
[0161] The above is only the preferred embodiment of the present application, and does not limit the patent scope of the present application, and any equivalent structure or equivalent process transformation, or direct or indirect application in other related technical fields, is also included in the patent protection scope of the present application.
Claims
1. A platform cluster deployment method, characterized in that: The platform cluster deployment method comprises the following steps: Determine the target cluster's environment information and generate a format file for the target cluster based on the environment information. The environment information includes: cluster name, platform engine, cluster server information, cluster host information, cluster domain name certificate, and the address of the container engine image library used by the cluster. Generate a task file corresponding to the target cluster based on a target container corresponding to the target cluster and the format file, where the target container is determined by business information corresponding to the target cluster; Starting the target cluster based on the target container and the task file; The step of starting the target cluster based on the target container and the task file includes: Based on the target container and the task file, obtaining an image file of a cluster server of the target cluster, and starting the cluster server based on the image file; Based on the cluster server, starting the cluster host of the target cluster; The step of starting the target cluster based on the target container and the task file includes: Determine whether a trust relationship is established between the target container and the target cluster, wherein if the public key of the cluster server of the target cluster exists in the cluster host of the target cluster, determine that a trust relationship is established between the target container and the target cluster, and the trust relationship includes a trust relationship between the target container and the cluster server of the target cluster, and a trust relationship between the target container and the cluster host of the target cluster; If yes, starting the target cluster based on the target container and the task file; Before the step of starting the cluster host of the target cluster based on the cluster server, the platform cluster deployment method further includes: Detecting whether the cluster server is started successfully. The cluster server includes a cluster server address, so that the built-in requests.Session module connects to the cluster server address to detect whether the cluster server is started successfully. If unsuccessful, a first error message is issued, and based on the target container and the task file, the image file of the cluster server is re-acquired, and the step of starting the cluster server is executed.
2. The platform cluster deployment method according to claim 1, wherein: After the step of starting the target cluster based on the target container and the task file, the platform cluster deployment method further includes: Determine a target stack ID corresponding to the target cluster, and determine a service status of the target cluster based on the target stack ID; If the service status is unhealthy, a second error message is issued.
3. The platform cluster deployment method according to claim 1, wherein: The step of determining the environment information of the target cluster and generating a format file of the target cluster based on the environment information includes: Determine the environment information of the target cluster based on the operating environment of the target cluster, and determine the file format corresponding to the target cluster based on the target container corresponding to the target cluster; According to the file format, the environment information is generated into a corresponding format file.
4. The platform cluster deployment method according to any one of claims 1 to 3, characterized in that: The step of generating a task file corresponding to the target cluster based on the target container corresponding to the target cluster and the format file includes: Determine the mount point of the target container corresponding to the target cluster for the format file, and mount the format file at the mount point; Based on the file template in the target container, in the target container, the format file under the mount point is used to generate a task file corresponding to the target cluster.
5. A platform cluster deployment device, characterized in that: The platform cluster deployment device includes: The first generation module is used to determine the environment information of the target cluster and generate a format file of the target cluster based on the environment information. The environment information includes: cluster name, platform engine, cluster server information, cluster host information, cluster domain name certificate, and the address of the container engine image library used by the cluster; A second generating module is configured to generate a task file corresponding to the target cluster based on a target container corresponding to the target cluster and the format file, wherein the target container is determined by business information corresponding to the target cluster; A startup module, configured to start the target cluster based on the target container and the task file; The startup module is further configured to obtain an image file of a cluster server of the target cluster based on the target container and the task file, and start the cluster server based on the image file; and start the cluster host of the target cluster based on the cluster server; The startup module is further configured to determine whether a trust relationship is established between the target container and the target cluster, wherein if the public key of the cluster server of the target cluster exists in the cluster host of the target cluster, then determining whether a trust relationship is established between the target container and the target cluster, wherein the trust relationship includes a trust relationship between the target container and the cluster server of the target cluster, and a trust relationship between the target container and the cluster host of the target cluster; if so, then starting the target cluster based on the target container and the task file; The startup module is further used to detect whether the cluster server is started successfully. The cluster server includes a cluster server address, so that the built-in requests.Session module connects to the cluster server address to detect whether the cluster server is started successfully; if not, a first error message is issued, and based on the target container and the task file, the image file of the cluster server is re-obtained, and the step of starting the cluster server is executed.
6. A platform cluster deployment system, characterized in that: The platform cluster deployment system includes a processor, a memory, and a platform cluster deployment program stored in the memory and executable by the processor, wherein when the platform cluster deployment program is executed by the processor, the steps of the platform cluster deployment method according to any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a platform cluster deployment program, wherein when the platform cluster deployment program is executed by a processor, the steps of the platform cluster deployment method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Maintenance method and device of cluster server
CN104243216A
Method for rapid deployment of openstack cloud computing platform
CN104580519A
Micro-service cluster deployment method and device, computer equipment and storage medium
CN111666080A
Method for carrying out automatic performance test on OpenStack cluster
CN111813420A