CN111866149A - Cluster deployment method and device, computer equipment and storage medium - Google Patents
Cluster deployment method and device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN111866149A CN111866149A CN202010716923.2A CN202010716923A CN111866149A CN 111866149 A CN111866149 A CN 111866149A CN 202010716923 A CN202010716923 A CN 202010716923A CN 111866149 A CN111866149 A CN 111866149A
- Authority
- CN
- China
- Prior art keywords
- cluster
- information
- deployment
- host
- configuration information
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
- H04L67/025—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1097—Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/146—Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/2866—Architectures; Arrangements
- H04L67/30—Profiles
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/34—Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/50—Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Stored Programmes (AREA)
Abstract
The invention relates to the field of cloud deployment, and provides a cluster deployment method, a cluster deployment device, computer equipment and a storage medium, wherein the method comprises the following steps: receiving a first deployment instruction, and acquiring first cluster deployment information of a first cluster to be deployed; acquiring first environment configuration information through a first python file; establishing communication connection with a first cluster deployment host through an SSH protocol, and logging in the first cluster deployment host; pushing first basic configuration information in the first environment configuration information to each first cluster deployment host through a first scripts script file; receiving a first basic deployment instruction; pushing first role configuration information in the first environment configuration information to each first cluster deployment host, and starting the first role configuration information through a docker client management tool; and after receiving all the role deployment instructions, completing the deployment of the first cluster to be deployed. The invention realizes the rapid and accurate configuration of each first cluster deployment host, can avoid the deployment error and improve the deployment efficiency.
Description
Technical Field
The invention relates to the field of distributed deployment of cloud deployment, in particular to a cluster deployment method and device, computer equipment and a storage medium.
Background
With the development of internet technology, the establishment and application of the cluster are more and more extensive, the deployment of the cluster plays more and more important roles in the process, and particularly, the deployment of a bare machine (a host which is not configured) and the upgrading and deployment verification of a configured host are particularly important in the establishment process of the cluster; in the prior art, most of cluster deployments are deployments with different environment configurations according to determined roles of different hosts in a cluster in a manual mode, the bare computers are easily missed to operate due to the fact that steps of environment configuration deployment are multiple, and therefore errors are caused in the cluster operation process; in addition, under the condition that configuration environments with two roles are deployed in the same host, cluster deployment errors are also easily caused; from the above, the scheme in the prior art greatly prolongs the deployment time of the cluster, reduces the deployment efficiency, and increases the operation cost.
Disclosure of Invention
The invention provides a cluster deployment method, a cluster deployment device, computer equipment and a storage medium, which can be used for acquiring corresponding link configuration information according to roles corresponding to cluster deployment hosts, rapidly and accurately configuring each cluster deployment host in a cluster to be deployed, avoiding deployment errors, improving deployment efficiency and reducing operation cost.
A cluster deployment method, comprising:
receiving a first deployment instruction, and acquiring first cluster deployment information of a first cluster to be deployed; the first cluster deployment information comprises at least one piece of first host information to be deployed, and the first host information to be deployed comprises first IP address information, first login information and a first role which are both associated with the first IP address information;
acquiring first environment configuration information matched with each first role through a first python file, and associating the acquired first environment configuration information with the first host information to be deployed corresponding to the first environment configuration information; the first environment configuration information comprises first base configuration information and first role configuration information;
establishing communication connection between the cluster host matched with at least one piece of first IP address information through an SSH protocol, confirming the cluster host with the established communication connection as a first cluster deployment host, and logging in the first cluster deployment host according to the first login information associated with the first IP address information;
pushing the first basic configuration information to each first cluster deployment host through a first script file so that the first cluster deployment host can install operating system configuration and docker container configuration which both correspond to the basic deployment information;
receiving a first basic deployment instruction fed back by each first cluster deployment host according to the received first basic configuration information; the first basic deployment instruction is obtained after the first cluster deployment host sequentially installs the operating system configuration and the docker container configuration according to the basic deployment information;
pushing the first role configuration information matched with the first role corresponding to the first cluster deployment host to each first cluster deployment host, and starting the first role configuration information through a docker client management tool;
after receiving role deployment instructions fed back by all the first cluster deployment hosts according to the received first role configuration information, determining all the first cluster deployment hosts as the first cluster to be deployed, and completing deployment of the first cluster to be deployed.
A cluster deployment apparatus comprising:
the receiving module is used for receiving a first deployment instruction and acquiring first cluster deployment information of a first cluster to be deployed; the first cluster deployment information comprises at least one piece of first host information to be deployed, and the first host information to be deployed comprises first IP address information, first login information and a first role which are both associated with the first IP address information;
the acquisition module is used for acquiring first environment configuration information matched with each first role through a first python file and associating the acquired first environment configuration information with the first host information to be deployed corresponding to the acquired first environment configuration information; the first environment configuration information comprises first base configuration information and first role configuration information;
the connection module is used for establishing communication connection between the cluster host matched with at least one piece of first IP address information through an SSH protocol, confirming the cluster host with the established communication connection as a first cluster deployment host, and logging in the first cluster deployment host according to the first login information associated with the first IP address information;
the pushing module is used for pushing the first basic configuration information to each first cluster deployment host through a first scripts script file so that the first cluster deployment host can install operating system configuration and docker container configuration which both correspond to the basic deployment information;
a feedback module, configured to receive a first basic deployment instruction, which is fed back by each first cluster deployment host according to the received first basic configuration information; the first basic deployment instruction is obtained after the first cluster deployment host sequentially installs the operating system configuration and the docker container configuration according to the basic deployment information;
the starting module is used for pushing the first role configuration information matched with the first role corresponding to the first cluster deployment host to each first cluster deployment host and starting the first role configuration information through a docker client management tool;
and the determining module is configured to determine all the first cluster deployment hosts as the first cluster to be deployed after receiving the role deployment instruction fed back by all the first cluster deployment hosts for the received first role configuration information, and complete deployment of the first cluster to be deployed.
A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the cluster deployment method described above when executing the computer program.
A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the cluster deployment method described above.
According to the cluster deployment method, the cluster deployment device, the computer equipment and the storage medium, the first cluster deployment information of the first cluster to be deployed is obtained by receiving the first deployment instruction; acquiring first environment configuration information matched with each first role through a first python file, and associating the acquired first environment configuration information with the first host information to be deployed corresponding to the first environment configuration information; establishing communication connection with a first cluster deployment host through an SSH protocol, and logging in the first cluster deployment host; pushing first basic configuration information in the first environment configuration information to each first cluster deployment host through a first scripts script file, so that the first cluster deployment host installs operating system configuration and docker container configuration which both correspond to the basic deployment information; receiving a first basic deployment instruction fed back by each first cluster deployment host according to the received first basic configuration information; pushing first role configuration information in the first environment configuration information matched with the first role corresponding to the first cluster deployment host to each first cluster deployment host, and starting the first role configuration information through a docker client management tool; after receiving role deployment instructions fed back by all the first cluster deployment hosts according to the received first role configuration information, determining all the first cluster deployment hosts as the first cluster to be deployed to complete deployment of the first cluster to be deployed, so that deployment of the first cluster deployment hosts in the first cluster to be deployed is realized according to the first cluster deployment information by one key, and by applying python language, SSH technology, scripts language and docker client management tools, obtaining corresponding first link configuration information according to the first role corresponding to the first cluster deployment hosts is realized, so that each first cluster deployment host in the first cluster to be deployed is rapidly and accurately configured, deployment errors can be avoided, deployment efficiency is improved, and operation cost is reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive labor.
FIG. 1 is a schematic diagram of an application environment of a cluster deployment method according to an embodiment of the present invention;
FIG. 2 is a flow chart of a cluster deployment method in an embodiment of the invention;
FIG. 3 is a flowchart of step S70 of the cluster deployment method in an embodiment of the present invention;
FIG. 4 is a flowchart of step S20 of the cluster deployment method in an embodiment of the present invention;
FIG. 5 is a flowchart of step S60 of the cluster deployment method in an embodiment of the present invention;
FIG. 6 is a flowchart of step S601 of the cluster deployment method in an embodiment of the present invention;
FIG. 7 is a flowchart of step S70 of the cluster deployment method in an embodiment of the present invention;
FIG. 8 is a flowchart of step S70 of a cluster deployment method in another embodiment of the present invention;
FIG. 9 is a functional block diagram of a cluster deployment device in an embodiment of the present invention;
FIG. 10 is a schematic diagram of a computer device in an embodiment of the invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The cluster deployment method provided by the invention can be applied to the application environment shown in fig. 1, wherein a client (computer device) communicates with a server through a network. The client (computer device) includes, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, cameras, and portable wearable devices. The server may be implemented as a stand-alone server or as a server cluster consisting of a plurality of servers.
In an embodiment, as shown in fig. 2, a cluster deployment method is provided, which mainly includes the following steps S10-S70:
s10, receiving a first deployment instruction, and acquiring first cluster deployment information of a first cluster to be deployed; the first cluster deployment information comprises at least one first host information to be deployed, and the first host information to be deployed comprises first IP address information, first login information and a first role, wherein the first login information and the first role are both associated with the first IP address information.
Understandably, the first cluster to be deployed is a cluster that needs to be deployed, the first cluster to be deployed includes a plurality of cluster hosts, the cluster hosts may be bare computers or hosts, the bare computers are computers that do not make any environment configuration, the first deployment instruction is an instruction that triggers one first cluster to be deployed or a plurality of first clusters to be deployed that need to be deployed, according to the first deployment instruction, the first cluster deployment information of the first cluster to be deployed may be obtained, or the first cluster deployment information of the plurality of first clusters to be deployed may be obtained, the first cluster deployment information is information that needs to be deployed for the first cluster to be deployed, the first cluster deployment information includes information of the plurality of first hosts to be deployed, the information of the first hosts to be deployed includes first IP address information, The first login information and the first role are both associated with the first IP address information, that is, one piece of information of the first host to be deployed includes one piece of the first IP address information, one piece of the first login information associated with the first IP address information and at least one piece of the first role associated with the first IP address information, the first role includes an orchestration layer role, a database layer role and an application layer role, the first IP address information is an IP address corresponding to a bare engine or a host that needs to build the first cluster to be deployed and information related to the IP address, the IP address is a unique identifier of the bare engine or the host, the first login information is information required for logging in the bare engine or the host corresponding to the IP address, and the first login information is not limited to a user name, a login password, and the like.
S20, acquiring first environment configuration information matched with each first role through a first python file, and associating the acquired first environment configuration information with the first host information to be deployed corresponding to the acquired first environment configuration information; the first environment configuration information includes first base configuration information and first persona configuration information.
Understandably, the first python file is a code file written based on python language, the first environment configuration information is obtained through the first python file, the first environment configuration information matched with the first role in the first host information to be deployed is obtained from the first environment configuration information according to one piece of the first host information to be deployed, the obtained first environment configuration information is associated with the first host information to be deployed, that is, one piece of the first host information to be deployed is associated with one piece of the first environment configuration information matched with the first role, wherein the matching mode can be set according to requirements, for example, the first environment configuration information contains contents associated with each first role, and the contents associated with the first role are determined as the first environment configuration information matched with the first role, the first environment configuration information includes the first basic configuration information and the first role configuration information, the first basic configuration information is configuration information related to a basic environment installed by a host in the first cluster to be deployed and provided for building the first cluster to be deployed, such as relevant code information of a system plugin, and the first role configuration information is different configuration information provided for the host in the first cluster to be deployed according to different roles, such as code information related to installation of a docker container, or code information related to installation of a kubernets container, and the like.
In an embodiment, as shown in fig. 4, the step S20, that is, the obtaining, through a first python file, first environment configuration information matching each first role, and associating the obtained first environment configuration information with the first host information to be deployed corresponding to the obtained first environment configuration information, further includes:
s201, a first environment configuration information set in the configuration file is obtained, wherein the first environment configuration information set comprises a plurality of first environment configuration information.
Understandably, the first environment configuration information set is a set of all the first environment configuration information, one of the first environment configuration information includes a role identifier, first basic configuration information and first role configuration information, both of which are associated with the role identifier, and the role identifier includes an orchestration layer, a database layer and an application layer.
S202, reading the role identification matched with the first role in the first host information to be deployed through the first python file, and converting the first environment configuration information corresponding to the role identification according to the role identification; the first host information to be deployed is file information in a JSON format, and the first environment configuration information is file information in an INI format.
Understandably, the first python file is a script file written by python voice, the first python file can interpret the role identifier from the first host information to be deployed, and convert the first environment configuration information according to the role identifier, and according to the first role in the first host information to be deployed, interpret the role identifier matching the first role by the first python file, extract the first environment configuration information corresponding to the role identifier from all the first environment configuration information, thereby converting the first host information to be deployed in JSON format into first environment configuration information in INI format, for example: the first role is a database layer role, the role identification is read out to be a database layer, and the first environment configuration information corresponding to the database is extracted from the first environment configuration information in a centralized manner, namely the first environment configuration information containing the database layer in all the first environment configuration information is extracted.
The first host information to be deployed is file information in a JSON format, and the first environment configuration information is file information in an INI format.
S203, associating the converted first environment configuration information with the corresponding first host information to be deployed.
Understandably, the first environment configuration information in the INI format is associated with the first host information to be deployed in the JSON format.
According to the method and the device, the first to-be-deployed host information in the JSON format is interpreted and converted into the first environment configuration information in the INI format which is convenient to configure through the python file, and the deployment efficiency is improved.
S30, establishing communication connection between the cluster host matched with at least one piece of first IP address information through SSH protocol, confirming the cluster host with established communication connection as a first cluster deployment host, and logging in the first cluster deployment host according to the first login information associated with the first IP address information.
Understandably, the SSH (secure shell) protocol is a security protocol established on an application layer basis, and a protocol with extremely high reliability and specially used for providing security for telnet sessions and other network services, the authentication modes of the SSH protocol include a password-based security authentication mode and a key-based security authentication mode, and the SSH protocol includes a transport layer protocol, a user authentication protocol and a connection protocol, queries a cluster host matched with at least one piece of first IP address matching information, establishes communication with the cluster host through the SSH protocol, identifies the cluster host with the established communication connection as a first cluster deployment host, and logs in the first cluster deployment host according to the first login information one-to-one associated with the first IP address, the first login information is information related to logging in the first cluster deployment host, the first login information includes a login administrator name, an administrator login password, and the like.
And S40, pushing the first basic configuration information to each first cluster deployment host through a first scripts script file, so that the first cluster deployment host can install the operating system configuration and the docker container configuration which both correspond to the basic deployment information.
Understandably, the first script file is a script file written based on a script language, the first script file realizes that the first basic configuration information is pushed to the first cluster deployment host, the first cluster deployment host can install the operating system configuration and the docker container configuration included in the first basic configuration information according to the first basic configuration information, the operating system configuration is a configuration related to a plug-in of an operating system, and the docker container configuration is a configuration that needs to realize a function related to a docker container.
S50, receiving a first basic deployment instruction fed back by each first cluster deployment host according to the received first basic configuration information; the first basic deployment instruction is obtained after the first cluster deployment host sequentially installs the operating system configuration and the docker container configuration according to the basic deployment information.
Understandably, the first cluster deployment host sequentially installs the operating system configuration and the docker container configuration according to the basic deployment information, and after the first cluster deployment host is installed, the first basic deployment instruction is fed back, and the first basic deployment instruction indicates that the first cluster deployment host has completed installation and installation of the received first basic configuration information.
S60, pushing the first role configuration information matched with the first role corresponding to the first cluster deployment host to each first cluster deployment host, and starting the first role configuration information through a docker client management tool.
Understandably, pushing the first role configuration information matched with the first role corresponding to the first cluster deployment host to each first cluster deployment host, that is, one first cluster deployment host corresponds to one or more first roles, acquires the first role configuration information matched with the first role, and sends one or more first role configuration information matched with the first role to the first cluster deployment host, the docker client management tool provides docker management of multiple servers, the docker client management tool comprises functions of mirror query, mirror pull, mirror delete, container creation, container start, container stop, container delete, dynamic log view, container entry and the like, and sending a starting instruction corresponding to the first role configuration information to each first cluster deployment host through the docker client management tool.
In an embodiment, as shown in fig. 5, the step S60, that is, pushing the first role configuration information matching the first role corresponding to the first cluster deployment host to each first cluster deployment host, and starting the first role configuration information through a docker client management tool includes:
s601, if the first role corresponding to the first cluster deployment host is the orchestration layer role, obtaining the orchestration layer configuration information of which kubernets contain kubernets version information and first plug-in information, pushing the orchestration layer configuration information to the first cluster deployment host, and starting the orchestration layer configuration information through the docker client management tool.
Understandably, if the first role corresponding to the first cluster deployment host is an orchestration layer role, acquiring orchestration layer configuration information, where the orchestration layer configuration information includes kubernets version information and first plug-in information corresponding to other plug-ins related to the orchestration layer role, the kubernets version information is related information of a kubernets version corresponding to the orchestration layer role that needs to be operated, the kubernets is an application platform used for managing containerization on multiple hosts in a cloud platform, the first plug-in information is a plug-in related to the orchestration layer role except the kubernets version information, the first plug-in information is information needed for performing an expansion function on the orchestration layer role, pushing the orchestration layer configuration information to the first cluster deployment host corresponding to the orchestration layer role, and the orchestration layer configuration information is information that is compiled according to the kubernets version information and the first plug-in information and can be executed by the docker client management tool The method comprises the steps that information, the Kubernetes version information can be mirror image files or file packets, a docker client management tool provides docker management on a plurality of servers, the docker client management tool comprises the functions of mirror image query, mirror image pull, mirror image deletion, container creation, container starting, container stopping, container deleting, log dynamic viewing, container entering and the like, and the configuration information of an arranging layer is started through the docker client management tool.
In an embodiment, as shown in fig. 6, in step S601, that is, the step of starting the orchestration layer configuration information through the docker client management tool includes:
s6011, acquiring the image file matched with the Kubernetes version through the docker client management tool.
Understandably, through the docker client management tool, in all historical image files, searching an image file matched with the kubernets version, and acquiring the image file, wherein the image file matched with the kubernets version is a file obtained by performing image processing on an installation file related to the kubernets version, one kubernets version corresponds to one image file, cross-platform installation can be realized by acquiring the image file, a platform of the first cluster deployment host is not required to be unified, and flexibility is enhanced.
S6012, the image file is pushed to the first cluster deployment host, and the image file is started through the docker client management tool.
Understandably, the image file is pushed to the first cluster deployment host, the image file is installed to the first cluster deployment host through the docker client management tool, and the image file in the first cluster deployment host is started, so that the first cluster deployment host is in an environment corresponding to the kubernets version.
S6013, after receiving a first kubernets receiving instruction from the first cluster deployment host for completing the mirror image file feedback, push the first plugin information to the first cluster deployment host, and start the first plugin information through the docker client management tool.
Understandably, after the first cluster deployment host starts the image file, feeding back the first kubernets receiving instruction, where the first kubernets receiving instruction indicates that the first cluster deployment host has already been installed to complete the corresponding kubernets version, and after that, pushing the first plugin information to the first cluster deployment host, and installing the first plugin information through the docker client management tool.
S6014, after receiving a first plug-in receiving instruction of the first cluster deployment host for starting the first plug-in information feedback, determining that pushing of the configuration information of the orchestration layer is completed.
Understandably, after receiving the first plug-in receiving instruction, the first plug-in information and the completion of the starting are described, so that the completion of pushing the configuration information of the arranging layer is determined.
According to the method, the device and the system, the image file matched with the Kubernets version is obtained through the docker client management tool to output the configuration information of the arrangement layer to be configured, and then the image file is pushed, so that cross-platform application of the Kubernets platform between the hosts is realized, the first cluster deployment host can receive the configuration information of the arrangement layer, and the first cluster deployment host can be ensured to be operated on the Kubernets platform.
S602, if the first role corresponding to the first cluster deployment host is the database layer role, acquiring the database layer configuration information containing database version information and second plug-in information, pushing the database layer configuration information to the cluster deployment host, and starting the database configuration information through the docker client management tool.
Understandably, if the first role corresponding to the first cluster deployment host is a database layer role, the database layer configuration information is obtained, the database layer configuration information comprises database version information and other second plug-in information corresponding to plug-ins related to the database layer role, the database version information is related to the database version corresponding to the database layer role, wherein the database can be selected according to requirements, such as the database is selected to be a MYSQL database, a Sybase or an Oracle and the like, the second plug-in information is a plug-in related to the database layer role except the database version information, and the second plug-in information is information required for the database layer role to perform an extended function, and the database layer configuration information is pushed to the first cluster deployment host corresponding to the database layer role, and the database layer configuration information is written according to the database version information and the second plug-in information and can be executed through the docker client management tool.
S603, if the first role corresponding to the first cluster deployment host is the application layer role, obtaining the application layer configuration information containing Rancher version information and third plug-in information, pushing the application layer configuration information to the cluster deployment host, and starting the application layer configuration information through the docker client management tool.
Understandably, if the first role corresponding to the first cluster deployment host is an application layer role, the application layer configuration information is obtained, where the application layer configuration information includes Rancher version information and third plugin information corresponding to other plugins related to the application layer role, the Rancher version information is related information of a Rancher version corresponding to the application layer role that needs to be run, the Rancher is a set of container management platform that can help organize containers easily and quickly in a production environment, the third plugin information is a plugin related to the application layer role except for the Rancher version information, and can be selected according to requirements, for example, the third plugin information is a SpringCloud version or the like, the third plugin information is information needed for performing an extended function on the application layer role, and the application layer configuration information is pushed to the first cluster deployment host corresponding to the application layer role, the application layer configuration information is written according to the database version information and the third plug-in information and can be executed through the docker client management tool.
The invention realizes better pushing different role configuration information corresponding to the roles of different hosts to the corresponding hosts and starting the hosts through the docker client management tool, and can accurately and effectively push the role configuration information.
S70, after receiving the role deployment instruction fed back by all the first cluster deployment hosts according to the received first role configuration information, determining all the first cluster deployment hosts as the first cluster to be deployed, and completing deployment of the first cluster to be deployed.
Understandably, the first cluster deployment host installs the received first role configuration information, feeds back the role deployment instruction after the installation is completed, and determines all the first cluster deployment hosts as the first cluster to be deployed after receiving all the role deployment instructions, that is, the first cluster deployment host forms one first cluster to be deployed, in the process, the implementation can be realized in two ways, and one implementation way is that as long as the role deployment instruction fed back by the first cluster deployment host is received, the first cluster deployment host determines that the first cluster deployment host is the first cluster to be deployed; in another implementation, after receiving the role deployment instruction fed back by the first cluster deployment host, sending an association detection file to the first cluster deployment host, where the association detection file is an association file written to ensure that no error occurs during the operation of the first cluster deployment host, the first cluster deployment host runs the association detection file to feed back an association detection result, and if the association detection result fed back by the first cluster deployment host is qualified, determining the first cluster deployment host as a part for constructing the first cluster to be deployed until all the first cluster deployment hosts are determined to be the first cluster to be deployed to indicate that deployment of the first cluster to be deployed is completed, so that clusters of uniform environmental configuration can be rapidly deployed, and different configurations are deployed according to roles of different hosts, the host in the cluster is accurately deployed, deployment errors are avoided, deployment efficiency is improved, and operation cost is reduced.
The method comprises the steps of obtaining first cluster deployment information of a first cluster to be deployed by receiving a first deployment instruction; the first cluster deployment information comprises at least one piece of first host information to be deployed, and the first host information to be deployed comprises first IP address information, first login information and a first role which are both associated with the first IP address information; acquiring first environment configuration information matched with each first role through a first python file, and associating the acquired first environment configuration information with the first host information to be deployed corresponding to the first environment configuration information; the first environment configuration information comprises first base configuration information and first role configuration information; establishing communication connection between the cluster host matched with at least one piece of first IP address information through an SSH protocol, confirming the cluster host with the established communication connection as a first cluster deployment host, and logging in the first cluster deployment host according to the first login information associated with the first IP address information; pushing the first basic configuration information to each first cluster deployment host through a first script file so that the first cluster deployment host can install operating system configuration and docker container configuration which both correspond to the basic deployment information; receiving a first basic deployment instruction fed back by each first cluster deployment host according to the received first basic configuration information; the first basic deployment instruction is obtained after the first cluster deployment host sequentially installs the operating system configuration and the docker container configuration according to the basic deployment information; pushing the first role configuration information matched with the first role corresponding to the first cluster deployment host to each first cluster deployment host, and starting the first role configuration information through a docker client management tool; after receiving role deployment instructions fed back by all the first cluster deployment hosts according to the received first role configuration information, determining all the first cluster deployment hosts as the first cluster to be deployed, and completing deployment of the first cluster to be deployed.
The method and the device realize that the first cluster deployment information of the first cluster to be deployed is obtained by receiving the first deployment instruction; acquiring first environment configuration information matched with each first role through a first python file, and associating the acquired first environment configuration information with the first host information to be deployed corresponding to the first environment configuration information; establishing communication connection with a first cluster deployment host through an SSH protocol, and logging in the first cluster deployment host; pushing first basic configuration information in the first environment configuration information to each first cluster deployment host through a first scripts script file, so that the first cluster deployment host installs operating system configuration and docker container configuration which both correspond to the basic deployment information; receiving a first basic deployment instruction fed back by each first cluster deployment host according to the received first basic configuration information; pushing first role configuration information in the first environment configuration information matched with the first role corresponding to the first cluster deployment host to each first cluster deployment host, and starting the first role configuration information through a docker client management tool; after receiving role deployment instructions fed back by all the first cluster deployment hosts according to the received first role configuration information, determining all the first cluster deployment hosts as the first cluster to be deployed to complete deployment of the first cluster to be deployed, so that deployment of the first cluster deployment hosts in the first cluster to be deployed is realized according to the first cluster deployment information by one key, and by applying python language, SSH technology, scripts language and docker client management tools, obtaining corresponding first link configuration information according to the first role corresponding to the first cluster deployment hosts is realized, so that each first cluster deployment host in the first cluster to be deployed is rapidly and accurately configured, deployment errors can be avoided, deployment efficiency is improved, and operation cost is reduced.
In an embodiment, as shown in fig. 7, in the step S70, after receiving the role deployment instruction fed back by all the first cluster deployment hosts with respect to the received first role configuration information, determining all the first cluster deployment hosts to complete the deployment of the first cluster to be deployed as the first cluster to be deployed includes:
s701, the first environment configuration information is decoded through the python joint tone file, and a joint tone detection file is generated.
Understandably, before the role deployment instruction is received, the python joint tone file is a file written by python voice, the python joint tone file realizes interpretation according to the content in the first environment configuration information, generates the joint tone detection file corresponding to the first environment configuration information, interprets joint tone codes corresponding to environment verification in the first cluster to be deployed according to the first basic configuration information and the first role configuration information in the first environment configuration information, and collects all the joint tone codes to obtain the joint tone detection file.
S702, after receiving the role deployment instruction, sending the joint debugging detection file to each first cluster deployment host.
Understandably, after receiving the role deployment instruction, sending the joint debugging detection file to each first cluster deployment host, where the sending mode is synchronous sending.
S703, determining the joint debugging detection result of the cluster to be deployed according to all the received detection instructions, and judging whether the joint debugging detection result is qualified; the detection instruction is obtained by the first cluster deployment host according to the received joint debugging detection file; the detection instruction includes a pass and a fail.
Understandably, the first cluster deployment host automatically runs the joint debugging detection file according to the received joint debugging detection file, the first cluster deployment host matches the corresponding joint debugging codes from the joint debugging detection file according to the corresponding first roles of the first cluster deployment host, automatically executes the joint debugging codes, and generates the detection instruction according to the result obtained after the joint debugging code is executed, and feeds back the detection instruction, determining joint debugging detection results of the clusters to be deployed according to the received detection instructions fed back by the first cluster deployment hosts, when all the detection instructions pass, determining that the joint debugging detection result of the cluster to be deployed is qualified, and when one of the detection instructions fails, determining that the joint debugging detection result of the cluster to be deployed is unqualified, and judging the joint debugging detection result.
S704, if the joint debugging detection result is qualified, determining all the first cluster deployment hosts as the first cluster to be deployed.
Understandably, if the joint debugging detection result is qualified, it indicates that the joint debugging is successful, that is, all the first cluster deployment hosts are determined as the first cluster to be deployed.
In an embodiment, as shown in fig. 8, after the step S703, that is, after determining whether the joint key detection result is qualified, the method further includes:
s705, if the joint debugging detection result is unqualified, redeploying all the first cluster deployment hosts to be reset until all the received detection instructions pass, and determining all the first cluster deployment hosts and all the first cluster deployment hosts to be reset after redeployment as the clusters to be deployed; the resetting of the first cluster deployment host means that the detection instruction fed back by the first cluster deployment host is the failed first cluster deployment host.
Understandably, if the joint debugging detection result is unqualified, it indicates that part of the first cluster deployment hosts fail to be successfully jointed, all the first cluster deployment hosts are relocated until the detection instruction fed back by all the first cluster deployment hosts is received as pass, the first cluster deployment hosts are reset to indicate that the detection instruction fed back by the first cluster deployment hosts is the failed first cluster deployment host, the first cluster deployment hosts which pass the received detection instruction do not need to be relocated, and finally all the first cluster deployment hosts and all the first cluster deployment hosts reset after being relocated are determined as the clusters to be deployed.
The invention realizes generation of the joint debugging detection file through the python joint debugging file, joint debugging detection is carried out on each first cluster deployment host through the joint debugging detection file, whether the first cluster to be deployed completes deployment or not is determined according to the joint debugging detection result, and the method for detecting the deployment of the cluster to be deployed is provided, so that the cluster to be deployed can be ensured to be deployed correctly.
In an embodiment, as shown in fig. 3, after the step S70, that is, after completing the deployment of the first cluster to be deployed, the method includes:
s80, receiving a second deployment instruction, and acquiring second cluster deployment information of a second cluster to be deployed; the second cluster deployment information comprises at least one second host to be deployed information; the second host information to be deployed comprises second IP address information, second login information and a second role which are both associated with the second IP address information.
Understandably, the second cluster to be deployed is a cross-cluster that needs to be deployed in an original cluster or in a plurality of original clusters, the second cluster to be deployed includes hosts already deployed under the plurality of clusters, the second deployment instruction is an instruction that triggers one or more second clusters to be deployed that need to be deployed, according to the second deployment instruction, the second cluster deployment information of one or more second clusters to be deployed can be obtained, and the second cluster deployment information of the plurality of second clusters to be deployed can also be obtained, the second cluster deployment information is information that needs to be deployed for the second cluster to be deployed, the second cluster deployment information includes information of a plurality of second hosts to be deployed, and the information of the second hosts to be deployed includes information of a second IP address, The second login information and the second role are both associated with the second IP address information, that is, one piece of information of the second host to be deployed includes one piece of information of the second IP address, one piece of second login information associated with the second IP address information and at least one piece of second role associated with the second IP address information, the second role includes an orchestration layer role, a database layer role and an application layer role, the second IP address information is an IP address corresponding to a bare computer or a host of the second cluster to be deployed that needs to be built and information associated with the IP address, the IP address is a unique identifier of the host that has already been deployed, the second login information is information required for logging in the host that has already been deployed and corresponding to the IP address, and the second login information is not limited to a user name, a login password, and the like.
S90, obtaining second environment configuration information matched with each second role through a second python file, and associating the obtained second environment configuration information with the second host information to be deployed corresponding to the second environment configuration information; the second environment configuration information includes second basic configuration information and second role configuration information.
Understandably, the second python file is a code file written based on python language, the second environment configuration information is obtained through the second python file, the second environment configuration information matched with the second role in the second host information to be deployed is obtained from the second environment configuration information according to one piece of the second host information to be deployed, the obtained first environment configuration information is associated with the second host information to be deployed, that is, one piece of the second host information to be deployed is associated with one piece of the second environment configuration information matched with the second role, wherein the matching mode can be set according to requirements, for example, the second environment configuration information includes contents associated with each second role, and the contents associated with the second role are determined as the second environment configuration information matched with the second role, the second environment configuration information includes the second basic configuration information and the second role configuration information, the second basic configuration information is configuration information related to a basic environment installed by a host in the second cluster to be deployed for building the second cluster to be deployed, for example, related code information of a system plug-in is installed, and the second role configuration information is different configuration information provided for the host in the second cluster to be deployed according to different roles, for example, code information related to installation of a docker container, or code information related to installation of a kubernets container, and the like.
S100, establishing communication connection between the cluster host matched with at least one piece of second IP address information through an SSH protocol, confirming the cluster host with the established communication connection as a second cluster deployment host, and logging in the second cluster deployment host according to second login information associated with the second IP address information.
Understandably, the SSH (secure shell) protocol is a security protocol established on an application layer basis, and a protocol with extremely high reliability and specially used for providing security for telnet sessions and other network services, the authentication modes of the SSH protocol include a password-based security authentication mode and a key-based security authentication mode, and the SSH protocol includes a transport layer protocol, a user authentication protocol and a connection protocol, queries a cluster host matched with at least one piece of second IP address matching information, establishes communication with the cluster host through the SSH protocol, identifies the cluster host with the established communication connection as a second cluster deployment host, and logs in the second cluster deployment host according to the second login information one-to-one associated with the second IP address, the second login information is information related to the second cluster deployment host, the second login information includes a login administrator name, an administrator login password, and the like.
S110, acquiring an environment version of each second cluster deployment host through a second scripts script file, and acquiring a difference environment version in the second basic configuration information and a difference role version in the second role configuration information according to the environment version; the environment version comprises a basic version and an extended version; the difference environment version is a basic environment version which is different from the basic version of the second cluster deployment host in the second basic configuration information; the different role version is a role environment version in the second role configuration information that is different from the extended version of the second cluster deployment host.
Understandably, the second scripts script file is a script file written based on a script language, the second scripts enabling obtaining a version of the environment of the second cluster deployment host, the environment version comprises a plurality of basic versions and a plurality of extended versions, the basic environment version which is different from all the basic versions is found out from the second basic configuration information, determining the basic environment version in the second basic configuration information different from or not equal to the corresponding basic version as the difference environment version, finding out the role environment version different from all the extended versions from the second role configuration information, that is, the version of the character environment in the second character configuration information that is different or not equal to the extended version corresponding to the version of the character environment is determined as the different character version.
S120, screening out basic difference information corresponding to the difference environment version of each second cluster deployment host from the second basic configuration information through the second scripts, and pushing the basic difference information corresponding to each second cluster deployment host to the second cluster deployment hosts; the base difference information includes a difference configuration for installation by the second cluster deployment host.
Understandably, basic difference information corresponding to the difference environment version of each second cluster deployment host is screened out from the second basic configuration information through the second scripts, if the basic environment versions in the second basic configuration information all have information corresponding to the basic environment version, the difference environment versions also have information corresponding to the difference versions, and the corresponding information is confirmed as the basic difference information, that is, different information between the basic environment version and the difference environment version is determined as the basic difference information.
S130, receiving a second basic deployment instruction fed back by each second cluster deployment host according to the received basic difference information, where the second basic deployment instruction is generated after the second cluster deployment host installs the difference configuration in the received basic difference information.
Understandably, the second cluster deployment host installs the difference configuration in the received basic difference information, and after the second cluster deployment host completes installation, feeds back the second basic deployment instruction, where the second basic deployment instruction indicates that the second cluster deployment host installs and completes installation of the received difference configuration.
S140, pushing role difference information corresponding to the difference role version of each second cluster deployment host from the second role configuration information to each second cluster deployment host, and starting the role difference information through the docker client management tool.
Understandably, role difference information corresponding to the difference role version is screened out from the second role configuration information according to the difference role version, then the role difference information is sent to the second cluster deployment host, the docker client management tool provides docker management for a plurality of servers, the docker client management tool comprises functions of mirror image query, mirror image pull, mirror image deletion, container creation, container starting, container stopping, container deleting, dynamic log viewing, container entering and the like, and a starting instruction corresponding to the role difference information is sent to each second cluster deployment host through the docker client management tool.
S150, after receiving deployment success instructions fed back by all the second cluster deployment hosts according to the received role difference information, determining the second cluster deployment hosts as the second cluster to be deployed, and completing deployment of the second cluster to be deployed.
Understandably, the second cluster deployment host installs the received first role difference information, feeds back the deployment success instruction after the installation is completed, and determines all the second cluster deployment hosts as the second cluster to be deployed after all the deployment success instructions are received, that is, the second cluster deployment host forms one second cluster to be deployed, in the process, the implementation can be realized in two ways, and one implementation mode is that as long as the deployment success instruction fed back by the second cluster deployment host is received, one second cluster deployment host is determined as the second cluster to be deployed; another implementation manner is that after receiving the deployment success instruction fed back by the second cluster deployment host, a cross-cluster joint tone detection file is sent to the second cluster deployment host, where the cross-cluster joint tone detection file is a joint tone file written to ensure that no error occurs in the operation process of the second cluster deployment host, the second cluster deployment host operates the cross-cluster joint tone detection file to feed back a cross-cluster joint tone detection result, and if the cross-cluster joint tone detection result fed back by the second cluster deployment host is received as qualified, the second cluster deployment host is determined as a part of the second cluster to be deployed until all the second cluster deployment hosts are determined as the second cluster to be deployed, which indicates that deployment of the second cluster is completed.
The invention realizes that the second cluster deployment information of the second cluster to be deployed is obtained by receiving the second deployment instruction; acquiring second environment configuration information matched with each second role through a second python file, and associating the acquired second environment configuration information with the second host information to be deployed corresponding to the acquired second environment configuration information; establishing communication connection between the cluster host matched with at least one piece of second IP address information through an SSH protocol, confirming the cluster host with the established communication connection as a second cluster deployment host, and logging in the second cluster deployment host according to second login information associated with the second IP address information; acquiring an environment version of each second cluster deployment host through a second script file, and acquiring a difference environment version in the second basic configuration information and a difference role version in the second role configuration information according to the environment version; screening out basic difference information corresponding to the difference environment version of each second cluster deployment host from the second basic configuration information through the second scripts, and pushing the basic difference information corresponding to each second cluster deployment host to the second cluster deployment hosts; receiving a second basic deployment instruction fed back by each second cluster deployment host according to the received basic difference information, wherein the second basic deployment instruction is generated after the second cluster deployment host installs the difference configuration in the received basic difference information; pushing role difference information corresponding to the difference role version of each second cluster deployment host from the second role configuration information to each second cluster deployment host, and starting the role difference information through the docker client management tool; after receiving deployment success instructions fed back by all the second cluster deployment hosts according to the received role difference information, determining the second cluster deployment hosts as the second cluster to be deployed, and completing deployment of the second cluster to be deployed. Therefore, the one-key deployment of the second cluster deployment hosts (the deployed hosts) in the second cluster to be deployed is realized according to the second cluster deployment information, the difference environment versions and the difference role versions corresponding to the second cluster deployment hosts are found out, and then only the difference points of the second cluster deployment hosts are deployed, so that the deployment time of the same version is reduced, the deployment steps are simplified, the deployed hosts in the second cluster to be deployed are rapidly and accurately configured, and the deployment efficiency can be improved.
In an embodiment, a cluster deployment device is provided, and the cluster deployment device corresponds to the cluster deployment methods in the embodiments one to one. As shown in fig. 8, the cluster deploying apparatus includes a receiving module 11, an obtaining module 12, a connecting module 13, a pushing module 14, a feedback module 15, a starting module 16, and a determining module 17. The functional modules are explained in detail as follows:
the receiving module 11 is configured to receive a first deployment instruction, and obtain first cluster deployment information of a first cluster to be deployed; the first cluster deployment information comprises at least one piece of first host information to be deployed, and the first host information to be deployed comprises first IP address information, first login information and a first role which are both associated with the first IP address information;
an obtaining module 12, configured to obtain, through a first python file, first environment configuration information matched with each of the first roles, and associate the obtained first environment configuration information with the first to-be-deployed host information corresponding to the first environment configuration information; the first environment configuration information comprises first base configuration information and first role configuration information;
a connection module 13, configured to establish, through an SSH protocol, a communication connection with at least one cluster host that matches the first IP address information, identify the cluster host that has established the communication connection as a first cluster deployment host, and log in the first cluster deployment host according to the first login information associated with the first IP address information;
a pushing module 14, configured to push the first basic configuration information to each first cluster deployment host through a first script file, so that the first cluster deployment host installs an operating system configuration and a docker container configuration that both correspond to the basic deployment information;
a feedback module 15, configured to receive a first basic deployment instruction, which is fed back by each first cluster deployment host according to the received first basic configuration information; the first basic deployment instruction is obtained after the first cluster deployment host sequentially installs the operating system configuration and the docker container configuration according to the basic deployment information;
a starting module 16, configured to push, to each first cluster deployment host, the first role configuration information matched with the first role corresponding to the first cluster deployment host, and start the first role configuration information through a docker client management tool;
a determining module 17, configured to determine all the first cluster deployment hosts as the first cluster to be deployed after receiving the role deployment instruction fed back by all the first cluster deployment hosts for the received first role configuration information, and complete deployment of the first cluster to be deployed.
In one embodiment, the determining module 17 includes:
the receiving unit is used for receiving a second deployment instruction and acquiring second cluster deployment information of a second cluster to be deployed; the second cluster deployment information comprises at least one second host to be deployed information; the second host information to be deployed comprises second IP address information, second login information and a second role which are both associated with the second IP address information;
the first obtaining unit is used for obtaining second environment configuration information matched with each second role through a second python file, and associating the obtained second environment configuration information with the second host information to be deployed corresponding to the second environment configuration information; the second environment configuration information comprises second basic configuration information and second role configuration information;
the connection unit is used for establishing communication connection between the cluster host matched with at least one piece of second IP address information through an SSH protocol, confirming the cluster host with the established communication connection as a second cluster deployment host, and logging in the second cluster deployment host according to the second login information associated with the second IP address information;
a difference unit, configured to obtain, through a second scripts script file, an environment version of each second cluster deployment host, and obtain, according to the environment version, a difference environment version in the second basic configuration information and a difference role version in the second role configuration information; the environment version comprises a basic version and an extended version; the difference environment version is a basic environment version which is different from the basic version of the second cluster deployment host in the second basic configuration information; the different role version is a role environment version which is different from the extended version of the second cluster deployment host in the second role configuration information;
a pushing unit, configured to screen, through the second scripts, basic difference information corresponding to the difference environment version of each second cluster deployment host from the second basic configuration information, and push the basic difference information corresponding to the second cluster deployment host to each second cluster deployment host; the basic difference information comprises a difference configuration for installing the second cluster deployment host;
a deployment unit, configured to receive a second basic deployment instruction fed back by each second cluster deployment host according to the received basic difference information, where the second basic deployment instruction is generated after the second cluster deployment host installs the difference configuration in the received basic difference information;
a starting unit, configured to push, to each second cluster deployment host, role difference information corresponding to the difference role version of each second cluster deployment host, which is screened from the second role configuration information, and start the role difference information through the docker client management tool;
a determining unit, configured to determine that there is the second cluster deployment host as the second cluster to be deployed after receiving deployment success instructions fed back by all the second cluster deployment hosts for the received role difference information, and complete deployment of the second cluster to be deployed.
In one embodiment, the obtaining module 12 includes:
a second obtaining unit, configured to obtain a first environment configuration information set in a configuration file, where the first environment configuration information set includes a plurality of first environment configuration information;
the interpretation unit is used for interpreting and reading the role identifier matched with the first role in the first host information to be deployed through the first python file, and converting the first environment configuration information corresponding to the role identifier according to the role identifier; the first host information to be deployed is file information in a JSON format, and the first environment configuration information is file information in an INI format;
and the association unit is used for associating the converted first environment configuration information with the corresponding first host information to be deployed.
In one embodiment, the activation module 16 includes:
a third obtaining unit, configured to obtain, if the first role corresponding to the first cluster deployment host is the orchestration layer role, the orchestration layer configuration information whose kubernets contain kubernets version information and first plug-in information, push the orchestration layer configuration information to the first cluster deployment host thereof, and start the orchestration layer configuration information through the docker client management tool;
a fourth obtaining unit, configured to obtain, if the first role corresponding to the first cluster deployment host is the database layer role, the database layer configuration information including database version information and second plug-in information, push the database layer configuration information to the cluster deployment host thereof, and start the database configuration information through the docker client management tool;
a fifth obtaining unit, configured to obtain, if the first role corresponding to the first cluster deployment host is the application layer role, the application layer configuration information including rancher version information and third plug-in information, push the application layer configuration information to the cluster deployment host, and start the application layer configuration information through the docker client management tool.
In one embodiment, the third obtaining unit includes:
the acquiring subunit is used for acquiring the mirror image file matched with the Kubernetes version through the docker client management tool;
the pushing subunit is used for pushing the image file to the first cluster deployment host and starting the image file through the docker client management tool;
a receiving subunit, configured to push the first plugin information to the first cluster deployment host after receiving a first kubernets receiving instruction, fed back by the first cluster deployment host for starting the image file, and start the first plugin information through the docker client management tool;
and the determining subunit is configured to determine that pushing of the configuration information of the orchestration layer is completed after receiving a first plug-in receiving instruction, which is sent by the first cluster deployment host and fed back by the first plug-in information, of the first cluster deployment host.
In one embodiment, the determining module 17 includes:
the generating unit is used for reading the first environment configuration information through a python joint tone file to generate a joint tone detection file;
the sending unit is used for sending the joint debugging detection file to each first cluster deployment host after receiving the role deployment instruction;
the judging unit is used for determining the joint debugging detection result of the cluster to be deployed according to all the received detection instructions and judging whether the joint debugging detection result is qualified or not; the detection instruction is obtained by the first cluster deployment host according to the received joint debugging detection file; the detection instruction comprises a pass and a fail;
and the qualified unit is used for determining all the first cluster deployment hosts as the first cluster to be deployed if the joint debugging detection result is qualified.
In one embodiment, the determining unit includes:
the unqualified unit is used for redeploying all the first cluster deployment hosts reset if the joint debugging detection result is unqualified until all the received detection instructions pass, and determining all the first cluster deployment hosts and all the first cluster deployment hosts reset after redeployment as the clusters to be deployed; the resetting of the first cluster deployment host means that the detection instruction fed back by the first cluster deployment host is the failed first cluster deployment host.
For specific limitations of the cluster deployment device, reference may be made to the above limitations of the cluster deployment method, which is not described herein again. The modules in the cluster deploying apparatus can be implemented in whole or in part by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 9. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a cluster deployment method.
In one embodiment, a computer device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the cluster deployment method in the above embodiments is implemented.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which, when being executed by a processor, implements the cluster deployment method in the above embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, databases, or other media used in embodiments provided herein may include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.
Claims (10)
1. A method for cluster deployment, comprising:
receiving a first deployment instruction, and acquiring first cluster deployment information of a first cluster to be deployed; the first cluster deployment information comprises at least one piece of first host information to be deployed, and the first host information to be deployed comprises first IP address information, first login information and a first role which are both associated with the first IP address information;
acquiring first environment configuration information matched with each first role through a first python file, and associating the acquired first environment configuration information with the first host information to be deployed corresponding to the first environment configuration information; the first environment configuration information comprises first base configuration information and first role configuration information;
establishing communication connection between the cluster host matched with at least one piece of first IP address information through an SSH protocol, confirming the cluster host with the established communication connection as a first cluster deployment host, and logging in the first cluster deployment host according to the first login information associated with the first IP address information;
pushing the first basic configuration information to each first cluster deployment host through a first script file so that the first cluster deployment host can install operating system configuration and docker container configuration which both correspond to the basic deployment information;
receiving a first basic deployment instruction fed back by each first cluster deployment host according to the received first basic configuration information; the first basic deployment instruction is obtained after the first cluster deployment host sequentially installs the operating system configuration and the docker container configuration according to the basic deployment information;
pushing the first role configuration information matched with the first role corresponding to the first cluster deployment host to each first cluster deployment host, and starting the first role configuration information through a docker client management tool;
after receiving role deployment instructions fed back by all the first cluster deployment hosts according to the received first role configuration information, determining all the first cluster deployment hosts as the first cluster to be deployed, and completing deployment of the first cluster to be deployed.
2. The cluster deployment method of claim 1, wherein after completing deployment of the cluster to be deployed, comprising:
receiving a second deployment instruction, and acquiring second cluster deployment information of a second cluster to be deployed; the second cluster deployment information comprises at least one second host to be deployed information; the second host information to be deployed comprises second IP address information, second login information and a second role which are both associated with the second IP address information;
acquiring second environment configuration information matched with each second role through a second python file, and associating the acquired second environment configuration information with the second host information to be deployed corresponding to the acquired second environment configuration information; the second environment configuration information comprises second basic configuration information and second role configuration information;
establishing communication connection between the cluster host matched with at least one piece of second IP address information through an SSH protocol, confirming the cluster host with the established communication connection as a second cluster deployment host, and logging in the second cluster deployment host according to second login information associated with the second IP address information;
acquiring an environment version of each second cluster deployment host through a second script file, and acquiring a difference environment version in the second basic configuration information and a difference role version in the second role configuration information according to the environment version; the environment version comprises a basic version and an extended version; the difference environment version is a basic environment version which is different from the basic version of the second cluster deployment host in the second basic configuration information; the different role version is a role environment version which is different from the extended version of the second cluster deployment host in the second role configuration information;
screening out basic difference information corresponding to the difference environment version of each second cluster deployment host from the second basic configuration information through the second scripts, and pushing the basic difference information corresponding to each second cluster deployment host to the second cluster deployment hosts; the basic difference information comprises a difference configuration for installing the second cluster deployment host;
receiving a second basic deployment instruction fed back by each second cluster deployment host according to the received basic difference information, wherein the second basic deployment instruction is generated after the second cluster deployment host installs the difference configuration in the received basic difference information;
pushing role difference information corresponding to the difference role version of each second cluster deployment host from the second role configuration information to each second cluster deployment host, and starting the role difference information through the docker client management tool;
after receiving deployment success instructions fed back by all the second cluster deployment hosts according to the received role difference information, determining the second cluster deployment hosts as the second cluster to be deployed, and completing deployment of the second cluster to be deployed.
3. The cluster deployment method according to claim 1, wherein the obtaining, through a first python file, first environment configuration information matching each of the first roles, and associating the obtained first environment configuration information with the first host information to be deployed corresponding to the obtained first environment configuration information includes:
acquiring a first environment configuration information set in a configuration file, wherein the first environment configuration information set comprises a plurality of first environment configuration information;
reading the role identification matched with the first role in the first host information to be deployed through the first python file, and converting the first environment configuration information corresponding to the role identification according to the role identification; the first host information to be deployed is file information in a JSON format, and the first environment configuration information is file information in an INI format;
and associating the converted first environment configuration information with the corresponding first host information to be deployed.
4. The cluster deployment method of claim 1, wherein the first role comprises an orchestration layer role, a database layer role, and an application layer role, the role configuration information comprising orchestration layer configuration information, database layer configuration information, and application layer configuration information;
the pushing, to each first cluster deployment host, the first role configuration information matched with the first role corresponding to the first cluster deployment host, and starting, by a docker client management tool, the first role configuration information includes:
if the first role corresponding to the first cluster deployment host is the arrangement layer role, acquiring Kubernets containing Kubernets version information and first plug-in information of the arrangement layer configuration information, pushing the arrangement layer configuration information to the first cluster deployment host, and starting the arrangement layer configuration information through the docker client management tool;
if the first role corresponding to the first cluster deployment host is the database layer role, acquiring the database layer configuration information containing database version information and second plug-in information, pushing the database layer configuration information to the cluster deployment host, and starting the database configuration information through the docker client management tool;
if the first role corresponding to the first cluster deployment host is the application layer role, obtaining the application layer configuration information containing Rancher version information and third plug-in information, pushing the application layer configuration information to the cluster deployment host, and starting the application layer configuration information through the docker client management tool.
5. The cluster deployment method of claim 4, wherein said initiating the orchestration layer configuration information by the docker client management tool comprises:
acquiring a mirror image file matched with the Kubernetes version through the docker client management tool;
pushing the image file to the first cluster deployment host, and starting the image file through the docker client management tool;
after receiving a first Kubernets receiving instruction fed back by the first cluster deployment host for the mirror image file after starting, pushing the first plug-in information to the first cluster deployment host, and starting the first plug-in information through the docker client management tool;
and after receiving a first plug-in receiving instruction of the first cluster deployment host for finishing the information feedback of the first plug-in, determining that the configuration information push of the arranging layer is finished.
6. The cluster deployment method according to claim 1, wherein the determining, after receiving the role deployment instruction fed back by all the first cluster deployment hosts for the received first role configuration information, that all the first cluster deployment hosts complete the deployment of the first cluster to be deployed as the first cluster to be deployed comprises:
the first environment configuration information is decoded through a python joint tone file to generate a joint tone detection file;
after the role deployment instruction is received, the joint debugging detection file is sent to each first cluster deployment host;
determining a joint debugging detection result of the cluster to be deployed according to all received detection instructions, and judging whether the joint debugging detection result is qualified; the detection instruction is obtained by the first cluster deployment host according to the received joint debugging detection file; the detection instruction comprises a pass and a fail;
and if the joint debugging detection result is qualified, determining all the first cluster deployment hosts as the first cluster to be deployed.
7. The cluster deployment method of claim 6, wherein after determining whether the joint debugging detection result is qualified, the method comprises:
if the joint debugging detection result is unqualified, redeploying all the first cluster deployment hosts to be reset until all the received detection instructions pass, and determining all the first cluster deployment hosts and all the first cluster deployment hosts to be reset after redeployment as the clusters to be deployed; the resetting of the first cluster deployment host means that the detection instruction fed back by the first cluster deployment host is the failed first cluster deployment host.
8. A cluster deployment apparatus, comprising:
the receiving module is used for receiving a first deployment instruction and acquiring first cluster deployment information of a first cluster to be deployed; the first cluster deployment information comprises at least one piece of first host information to be deployed, and the first host information to be deployed comprises first IP address information, first login information and a first role which are both associated with the first IP address information;
the acquisition module is used for acquiring first environment configuration information matched with each first role through a first python file and associating the acquired first environment configuration information with the first host information to be deployed corresponding to the acquired first environment configuration information; the first environment configuration information comprises first base configuration information and first role configuration information;
the connection module is used for establishing communication connection between the cluster host matched with at least one piece of first IP address information through an SSH protocol, confirming the cluster host with the established communication connection as a first cluster deployment host, and logging in the first cluster deployment host according to the first login information associated with the first IP address information;
the pushing module is used for pushing the first basic configuration information to each first cluster deployment host through a first scripts script file so that the first cluster deployment host can install operating system configuration and docker container configuration which both correspond to the basic deployment information;
a feedback module, configured to receive a first basic deployment instruction, which is fed back by each first cluster deployment host according to the received first basic configuration information; the first basic deployment instruction is obtained after the first cluster deployment host sequentially installs the operating system configuration and the docker container configuration according to the basic deployment information;
the starting module is used for pushing the first role configuration information matched with the first role corresponding to the first cluster deployment host to each first cluster deployment host and starting the first role configuration information through a docker client management tool;
and the determining module is configured to determine all the first cluster deployment hosts as the first cluster to be deployed after receiving the role deployment instruction fed back by all the first cluster deployment hosts for the received first role configuration information, and complete deployment of the first cluster to be deployed.
9. 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 cluster deployment method as claimed in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the cluster deployment method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010716923.2A CN111866149B (en) | 2020-07-23 | 2020-07-23 | Cluster deployment method and device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010716923.2A CN111866149B (en) | 2020-07-23 | 2020-07-23 | Cluster deployment method and device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111866149A true CN111866149A (en) | 2020-10-30 |
CN111866149B CN111866149B (en) | 2023-09-05 |
Family
ID=72951031
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010716923.2A Active CN111866149B (en) | 2020-07-23 | 2020-07-23 | Cluster deployment method and device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111866149B (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112631614A (en) * | 2020-12-30 | 2021-04-09 | 平安证券股份有限公司 | Application deployment method and device, computer equipment and storage medium |
CN113190327A (en) * | 2021-04-30 | 2021-07-30 | 平安证券股份有限公司 | Micro-service deployment method, device, equipment and storage medium |
CN113282372A (en) * | 2021-05-31 | 2021-08-20 | 平安国际智慧城市科技股份有限公司 | Deployment method, device, equipment and storage medium of data collection cluster |
CN113722045A (en) * | 2021-07-26 | 2021-11-30 | 浪潮通用软件有限公司 | Cluster application deployment method and device |
CN113839821A (en) * | 2021-10-14 | 2021-12-24 | 京东科技信息技术有限公司 | Method, device, system, equipment and medium for deploying cluster and constructing infrastructure |
CN114116066A (en) * | 2021-11-30 | 2022-03-01 | 湖南麒麟信安科技股份有限公司 | Cloud platform cluster control method, system and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102333109A (en) * | 2010-06-15 | 2012-01-25 | 微软公司 | Techniques for efficient remote presentation session connectivity and routing |
CN105490849A (en) * | 2015-12-08 | 2016-04-13 | 中电科华云信息技术有限公司 | Automatic deployment method and system of application system |
CN108829433A (en) * | 2018-05-24 | 2018-11-16 | 努比亚技术有限公司 | A kind of web system version dispositions method, equipment and storage medium |
CN111258719A (en) * | 2020-01-19 | 2020-06-09 | 山东汇贸电子口岸有限公司 | Method and system for rapidly deploying multi-node Ceph cluster under single-machine KVM virtualization |
-
2020
- 2020-07-23 CN CN202010716923.2A patent/CN111866149B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102333109A (en) * | 2010-06-15 | 2012-01-25 | 微软公司 | Techniques for efficient remote presentation session connectivity and routing |
CN105490849A (en) * | 2015-12-08 | 2016-04-13 | 中电科华云信息技术有限公司 | Automatic deployment method and system of application system |
CN108829433A (en) * | 2018-05-24 | 2018-11-16 | 努比亚技术有限公司 | A kind of web system version dispositions method, equipment and storage medium |
CN111258719A (en) * | 2020-01-19 | 2020-06-09 | 山东汇贸电子口岸有限公司 | Method and system for rapidly deploying multi-node Ceph cluster under single-machine KVM virtualization |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112631614A (en) * | 2020-12-30 | 2021-04-09 | 平安证券股份有限公司 | Application deployment method and device, computer equipment and storage medium |
CN112631614B (en) * | 2020-12-30 | 2023-10-03 | 平安证券股份有限公司 | Application deployment method, device, computer equipment and storage medium |
CN113190327A (en) * | 2021-04-30 | 2021-07-30 | 平安证券股份有限公司 | Micro-service deployment method, device, equipment and storage medium |
CN113282372A (en) * | 2021-05-31 | 2021-08-20 | 平安国际智慧城市科技股份有限公司 | Deployment method, device, equipment and storage medium of data collection cluster |
CN113722045A (en) * | 2021-07-26 | 2021-11-30 | 浪潮通用软件有限公司 | Cluster application deployment method and device |
CN113722045B (en) * | 2021-07-26 | 2023-06-16 | 浪潮通用软件有限公司 | Cluster application deployment method and device |
CN113839821A (en) * | 2021-10-14 | 2021-12-24 | 京东科技信息技术有限公司 | Method, device, system, equipment and medium for deploying cluster and constructing infrastructure |
CN113839821B (en) * | 2021-10-14 | 2024-05-24 | 京东科技信息技术有限公司 | Method, device, system, equipment and medium for deploying clusters and constructing infrastructure |
CN114116066A (en) * | 2021-11-30 | 2022-03-01 | 湖南麒麟信安科技股份有限公司 | Cloud platform cluster control method, system and storage medium |
CN114116066B (en) * | 2021-11-30 | 2024-05-07 | 湖南麒麟信安科技股份有限公司 | Cloud platform cluster control method, system and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN111866149B (en) | 2023-09-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111866149B (en) | Cluster deployment method and device, computer equipment and storage medium | |
CN109032611B (en) | Script deployment method and device, computer equipment and storage medium | |
CN111666081B (en) | Git-based project version release method, device, equipment and medium | |
US20190266134A1 (en) | Data migration method, apparatus, and storage medium | |
CN109788032B (en) | Method and device for acquiring mirror image file, computer equipment and storage medium | |
CN108959385B (en) | Database deployment method, device, computer equipment and storage medium | |
CN109814854B (en) | Project framework generation method, device, computer equipment and storage medium | |
CN110569035A (en) | Code compiling method, device, equipment and storage medium of software development project | |
CN110908909A (en) | Automatic testing method and device, storage medium and equipment | |
CN109669859B (en) | Service testing method, device, computer equipment and storage medium | |
CN108418797B (en) | Webpage access method and device, computer equipment and storage medium | |
CN111857758B (en) | Application deployment method, device and medium | |
CN111683066A (en) | Heterogeneous system integration method and device, computer equipment and storage medium | |
CN108595280B (en) | Interface adaptation method and device, computer equipment and storage medium | |
CN112162924A (en) | Interface automation test method and device, computer equipment and storage medium | |
CN112860778A (en) | Database management method, device, equipment and medium for desktop application program | |
CN107766055A (en) | A kind of client linux system installation method based on GUI module | |
CN113835713A (en) | Source code package downloading method and device, computer equipment and storage medium | |
CN112114746A (en) | Automatic deployment method of distributed storage cluster | |
CN113190327B (en) | Micro-service deployment method, device, equipment and storage medium | |
CN113190371A (en) | Task compensation method and device, electronic equipment and readable storage medium | |
CN108471363B (en) | Conference system registration method and device capable of supporting multiple communication protocols | |
CN113051299A (en) | Proxy information processing method, proxy information processing device, computer equipment and storage medium | |
CN111338644A (en) | Task script deployment method and system | |
US20170318056A1 (en) | Method and device for monitoring the supply of authentication certificates to service nodes of a high-performance computer |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |