[go: up one dir, main page]

CN118740616A - Method, device, electronic device and storage medium for deploying server cluster - Google Patents

Method, device, electronic device and storage medium for deploying server cluster Download PDF

Info

Publication number
CN118740616A
CN118740616A CN202410831465.5A CN202410831465A CN118740616A CN 118740616 A CN118740616 A CN 118740616A CN 202410831465 A CN202410831465 A CN 202410831465A CN 118740616 A CN118740616 A CN 118740616A
Authority
CN
China
Prior art keywords
server
processed
devices
central node
operating system
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.)
Pending
Application number
CN202410831465.5A
Other languages
Chinese (zh)
Inventor
秦璞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Metabrain Intelligent Technology Co Ltd
Original Assignee
Suzhou Metabrain Intelligent Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Suzhou Metabrain Intelligent Technology Co Ltd filed Critical Suzhou Metabrain Intelligent Technology Co Ltd
Priority to CN202410831465.5A priority Critical patent/CN118740616A/en
Publication of CN118740616A publication Critical patent/CN118740616A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/085Retrieval of network configuration; Tracking network configuration history
    • H04L41/0853Retrieval of network configuration; Tracking network configuration history by actively collecting configuration information or by backing up configuration information
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0889Techniques to speed-up the configuration process
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1044Group management mechanisms 

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer And Data Communications (AREA)

Abstract

本发明实施例提供了一种部署服务器集群、装置、电子设备和存储介质,该方法通过预设的预启动执行环境服务器,对预设数量的设备部署服务器操作系统,并将部署所述服务器操作系统的设备作为中心节点服务器,然后获取中心节点服务器的设备信息,根据中心节点服务器的设备信息,确定中心节点服务器对待处理设备部署服务器操作系统时,允许同时部署的设备数量,再根据中心节点服务器允许同时部署的设备数量,对待处理设备部署服务器操作系统。从而避免了使用单台预启动执行环境服务器提供网络启动服务和操作系统镜像进行服务器集群部署,在网络中断或不稳定时导致的部署失败,从而提高了服务器集群部署的稳定性和效率。

The embodiment of the present invention provides a deployment server cluster, device, electronic device and storage medium. The method deploys a server operating system to a preset number of devices through a preset pre-start execution environment server, and uses the device for deploying the server operating system as a central node server, and then obtains the device information of the central node server, and determines the number of devices that the central node server allows to be deployed simultaneously when deploying the server operating system to the device to be processed according to the device information of the central node server, and then deploys the server operating system to the device to be processed according to the number of devices that the central node server allows to be deployed simultaneously. This avoids the use of a single pre-start execution environment server to provide network startup services and operating system images for server cluster deployment, and the deployment failure caused by network interruption or instability, thereby improving the stability and efficiency of server cluster deployment.

Description

部署服务器集群的方法、装置、电子设备和存储介质Method, device, electronic device and storage medium for deploying server cluster

技术领域Technical Field

本发明涉及服务器技术领域,特别是涉及一种部署服务器集群的方法、装置、电子设备和存储介质。The present invention relates to the field of server technology, and in particular to a method, device, electronic device and storage medium for deploying a server cluster.

背景技术Background Art

PXE(Preboot Execution Environment,预启动执行环境)是一种网络启动技术,它允许计算机通过网络从远程服务器上加载操作系统,而不是从本地硬盘启动。PXE通常用于大规模部署操作系统,特别是在企业环境中,可以大大简化新计算机或重装系统的部署过程。PXE (Preboot Execution Environment) is a network boot technology that allows a computer to load an operating system from a remote server over the network instead of booting from a local hard disk. PXE is often used to deploy operating systems on a large scale, especially in an enterprise environment, and can greatly simplify the deployment process of new computers or reinstalled systems.

现有技术使用PXE部署服务器集群时,只有一台PXE服务器来提供网络启动服务和操作系统镜像,在网络中的客户端数量非常多,或者网络带宽有限的情况下,任何网络中断或不稳定都可能导致部署失败,这种部署服务器集群的方式不够稳定可靠。When the existing technology uses PXE to deploy a server cluster, there is only one PXE server to provide network boot services and operating system images. When there are a large number of clients in the network or the network bandwidth is limited, any network interruption or instability may cause deployment failure. This method of deploying a server cluster is not stable and reliable enough.

发明内容Summary of the invention

鉴于上述问题,提出了本发明实施例以便提供一种克服上述问题或者至少部分地解决上述问题的一种部署服务器集群的方法、装置、电子设备和存储介质。In view of the above problems, embodiments of the present invention are proposed to provide a method, device, electronic device and storage medium for deploying a server cluster that overcome the above problems or at least partially solve the above problems.

为了解决上述问题,本发明实施例公开了一种部署服务器集群的方法,所述方法包括:In order to solve the above problem, an embodiment of the present invention discloses a method for deploying a server cluster, the method comprising:

通过预设的预启动执行环境服务器,对预设数量的设备部署服务器操作系统,并将部署所述服务器操作系统的设备作为中心节点服务器;Deploy a server operating system to a preset number of devices through a preset pre-start execution environment server, and use the devices where the server operating system is deployed as central node servers;

获取所述中心节点服务器的设备信息;Obtaining device information of the central node server;

根据所述中心节点服务器的设备信息,确定所述中心节点服务器对待处理设备部署服务器操作系统时,允许同时部署的设备数量;Determine, according to the device information of the central node server, the number of devices that the central node server is allowed to deploy simultaneously when deploying the server operating system on the processed device;

根据所述中心节点服务器允许同时部署的设备数量,对所述待处理设备部署服务器操作系统。According to the number of devices that the central node server allows to be deployed simultaneously, a server operating system is deployed on the device to be processed.

可选地,所述预设的预启动执行环境服务器包括容器镜像,所述容器镜像包括所述服务器操作系统镜像;所述通过预设的预启动执行环境服务器,对预设数量的设备部署服务器操作系统,包括:Optionally, the preset pre-boot execution environment server includes a container image, and the container image includes the server operating system image; and the deploying the server operating system to a preset number of devices through the preset pre-boot execution environment server includes:

将所述预设的预启动执行环境服务器的所述容器镜像分别发送至所述预设数量的设备;Sending the container image of the preset pre-start execution environment server to the preset number of devices respectively;

启动所述预设数量的设备中的容器镜像,对预设数量的设备部署服务器操作系统。The container images in the preset number of devices are started, and the server operating system is deployed on the preset number of devices.

可选地,所述中心节点服务器的所述设备信息包括中央处理器性能、内存大小、存储速度、当前负载或网络带宽至少一种;所述根据所述中心节点服务器的设备信息,确定所述中心节点服务器对待处理设备部署服务器操作系统时,允许同时部署的设备数量,包括:Optionally, the device information of the central node server includes at least one of central processing unit performance, memory size, storage speed, current load or network bandwidth; and determining, based on the device information of the central node server, the number of devices that the central node server is allowed to deploy simultaneously when deploying a server operating system on a device to be processed, includes:

根据所述中心节点服务器的中央处理器性能、内存大小、存储速度、当前负载或网络带宽至少一种,确定所述中心节点服务器对待处理设备部署服务器操作系统时,允许同时部署的设备数量。The number of devices that are allowed to be deployed simultaneously when the central node server deploys a server operating system on the processed devices is determined based on at least one of the central processing unit performance, memory size, storage speed, current load or network bandwidth of the central node server.

可选地,所述根据所述中心节点服务器允许同时部署的设备数量,对所述待处理设备部署服务器操作系统,包括:Optionally, the deploying a server operating system on the device to be processed according to the number of devices that the central node server allows to be deployed simultaneously includes:

确定所有的所述中心节点服务器允许同时部署的设备数量的总数量;Determine the total number of devices that all the central node servers are allowed to deploy simultaneously;

比较所述待处理设备的数量与所述总数量;Comparing the number of the devices to be processed with the total number;

在所述待处理设备的数量等于所述总数量时,通过所有的所述中心节点服务器,对所述待处理设备部署服务器操作系统;When the number of the devices to be processed is equal to the total number, deploying a server operating system on the devices to be processed through all the central node servers;

在所述待处理设备的数量小于所述总数量时,根据各个所述中心节点服务器允许同时部署的设备数量,确定目标中心节点服务器,通过所述目标中心节点服务器对所述待处理设备部署服务器操作系统;When the number of the devices to be processed is less than the total number, determining a target central node server according to the number of devices that each central node server allows to be deployed simultaneously, and deploying a server operating system to the devices to be processed through the target central node server;

在所述待处理设备的数量大于所述总数量时,根据每个所述中心节点服务器允许同时部署的设备数量,使每个所述中心节点服务器同时对对应数量的待处理设备部署服务器操作系统;以及每当所述中心节点服务器完成对待处理设备部署服务器操作系统的操作后,从剩余的待处理设备确定所述中心节点服务器所需处理的待处理设备并对所述所需处理的待处理设备部署服务器操作系统。When the number of the devices to be processed is greater than the total number, each of the central node servers simultaneously deploys the server operating system to the corresponding number of devices to be processed according to the number of devices that each of the central node servers is allowed to deploy simultaneously; and whenever the central node server completes the operation of deploying the server operating system to the devices to be processed, the devices to be processed that the central node server needs to process are determined from the remaining devices to be processed, and the server operating system is deployed to the devices to be processed that need to be processed.

可选地,所述中心节点服务器和所述待处理设备配置有服务发现,所述通过所有的所述中心节点服务器,对所述待处理设备部署服务器操作系统,包括:Optionally, the central node server and the device to be processed are configured with service discovery, and the deploying of a server operating system to the device to be processed through all the central node servers includes:

针对各个所述待处理设备,确定距离所述待处理设备最近的中心节点服务器;For each of the devices to be processed, determining the central node server closest to the device to be processed;

通过所述距离所述待处理设备最近的中心节点服务器,对所述待处理设备部署服务器操作系统。A server operating system is deployed on the device to be processed through the central node server that is closest to the device to be processed.

可选地,所述通过所述距离所述待处理设备最近的中心节点服务器,对所述待处理设备部署服务器操作系统,包括:Optionally, the deploying a server operating system on the device to be processed through the central node server that is closest to the device to be processed includes:

从所述距离所述待处理设备最近的中心节点服务器中获取容器镜像,并存储至所述待处理设备;Obtaining a container image from the central node server closest to the device to be processed, and storing it in the device to be processed;

启动所述待处理设备中的容器镜像,对所述待处理设备部署服务器操作系统。Start the container image in the device to be processed, and deploy a server operating system on the device to be processed.

可选地,所述启动所述待处理设备中的容器镜像包括:Optionally, starting the container image in the device to be processed includes:

获取启动所述待处理设备中的容器镜像的预设启动脚本;Obtaining a preset startup script for starting the container image in the device to be processed;

运行所述预设启动脚本,启动所述待处理设备中的容器镜像。Run the preset startup script to start the container image in the device to be processed.

相应的,本发明实施例公开了一种部署服务器集群的装置,所述装置包括:Accordingly, an embodiment of the present invention discloses a device for deploying a server cluster, the device comprising:

中心节点服务器部署模块,用于通过预设的预启动执行环境服务器,对预设数量的设备部署服务器操作系统,并将部署所述服务器操作系统的设备作为中心节点服务器;A central node server deployment module, used to deploy a server operating system to a preset number of devices through a preset pre-start execution environment server, and use the devices on which the server operating system is deployed as central node servers;

设备信息获取模块,用于获取所述中心节点服务器的设备信息;A device information acquisition module, used to acquire device information of the central node server;

确定模块,用于根据所述中心节点服务器的设备信息,确定所述中心节点服务器对待处理设备部署服务器操作系统时,允许同时部署的设备数量;A determination module, configured to determine, based on the device information of the central node server, the number of devices that the central node server is allowed to deploy simultaneously when deploying a server operating system on a device to be processed;

待处理设备部署模块,用于根据所述中心节点服务器允许同时部署的设备数量,对所述对待处理设备部署服务器操作系统。The device deployment module to be processed is used to deploy a server operating system to the device to be processed according to the number of devices that the central node server allows to be deployed simultaneously.

可选地,所述预设的预启动执行环境服务器包括容器镜像,所述容器镜像包括所述服务器操作系统镜像;所述中心节点服务器部署模块,包括:Optionally, the preset pre-start execution environment server includes a container image, and the container image includes the server operating system image; the central node server deployment module includes:

发送子模块,用于将所述预设的预启动执行环境服务器的所述容器镜像分别发送至所述预设数量的设备;A sending submodule, used for sending the container image of the preset pre-start execution environment server to the preset number of devices respectively;

启动子模块,用于启动所述预设数量的设备中的容器镜像,对预设数量的设备部署服务器操作系统。The startup submodule is used to start the container images in the preset number of devices and deploy the server operating system to the preset number of devices.

可选地,所述中心节点服务器的所述设备信息包括中央处理器性能、内存大小、存储速度、当前负载或网络带宽至少一种;所述确定模块,包括:Optionally, the device information of the central node server includes at least one of central processing unit performance, memory size, storage speed, current load or network bandwidth; and the determination module includes:

确定子模块,用于根据所述中心节点服务器的中央处理器性能、内存大小、存储速度、当前负载或网络带宽至少一种,确定所述中心节点服务器对待处理设备部署服务器操作系统时,允许同时部署的设备数量。The determination submodule is used to determine the number of devices allowed to be deployed simultaneously when the central node server deploys a server operating system on the processed device based on at least one of the central processing unit performance, memory size, storage speed, current load or network bandwidth of the central node server.

可选地,所述待处理设备部署模块,包括:Optionally, the to-be-processed device deployment module includes:

总数量确定子模块,用于确定所有的所述中心节点服务器允许同时部署的设备数量的总数量;A total number determination submodule, used to determine the total number of devices that all the central node servers are allowed to deploy simultaneously;

比较子模块,用于比较所述待处理设备的数量与所述总数量;A comparison submodule, used for comparing the number of the devices to be processed with the total number;

第一比较结果子模块,用于在所述待处理设备的数量等于所述总数量时,通过所有的所述中心节点服务器,对所述待处理设备部署服务器操作系统;A first comparison result submodule is used to deploy a server operating system to the devices to be processed through all the central node servers when the number of the devices to be processed is equal to the total number;

第二比较结果子模块,用于在所述待处理设备的数量小于所述总数量时,根据各个所述中心节点服务器允许同时部署的设备数量,确定目标中心节点服务器,通过所述目标中心节点服务器对所述待处理设备部署服务器操作系统;A second comparison result submodule is used to determine a target central node server according to the number of devices that each central node server allows to be deployed simultaneously when the number of the devices to be processed is less than the total number, and deploy a server operating system to the devices to be processed through the target central node server;

第三比较结果子模块,用于在所述待处理设备的数量大于所述总数量时,根据每个所述中心节点服务器允许同时部署的设备数量,使每个所述中心节点服务器同时对对应数量的待处理设备部署服务器操作系统;以及每当所述中心节点服务器完成对待处理设备部署服务器操作系统的操作后,从剩余的待处理设备确定所述中心节点服务器所需处理的待处理设备并对所述所需处理的待处理设备部署服务器操作系统。The third comparison result submodule is used to, when the number of the devices to be processed is greater than the total number, enable each of the central node servers to simultaneously deploy the server operating system to a corresponding number of devices to be processed according to the number of devices that each of the central node servers is allowed to deploy simultaneously; and whenever the central node server completes the operation of deploying the server operating system to the devices to be processed, determine the devices to be processed that the central node server needs to process from the remaining devices to be processed and deploy the server operating system to the devices to be processed.

可选地,所述中心节点服务器和所述待处理设备配置有服务发现,所述第一比较结果子模块,包括:Optionally, the central node server and the device to be processed are configured with service discovery, and the first comparison result submodule includes:

距离确定单元,用于针对各个所述待处理设备,确定距离所述待处理设备最近的中心节点服务器;A distance determination unit, used for determining, for each of the devices to be processed, a central node server closest to the device to be processed;

部署单元,用于通过所述距离所述待处理设备最近的中心节点服务器,对所述待处理设备部署服务器操作系统。The deployment unit is used to deploy a server operating system to the device to be processed through the central node server closest to the device to be processed.

可选地,所述部署单元,包括:Optionally, the deployment unit includes:

容器镜像获取子单元,用于从所述距离所述待处理设备最近的中心节点服务器中获取容器镜像,并存储至所述待处理设备;A container image acquisition subunit, configured to acquire a container image from a central node server closest to the device to be processed, and store the container image in the device to be processed;

启动子单元,用于启动所述待处理设备中的容器镜像,对所述待处理设备部署服务器操作系统。The startup subunit is used to start the container image in the device to be processed and deploy a server operating system to the device to be processed.

可选地,所述启动子单元,具体用于:Optionally, the promoter unit is specifically used for:

获取启动所述待处理设备中的容器镜像的预设启动脚本;Obtaining a preset startup script for starting the container image in the device to be processed;

运行所述预设启动脚本,启动所述待处理设备中的容器镜像。Run the preset startup script to start the container image in the device to be processed.

相应的,本发明实施例公开了一种电子设备,包括:处理器、存储器及存储在所述存储器上并能够在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行时实现上述模型训练方法实施例的各个步骤。Correspondingly, an embodiment of the present invention discloses an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the various steps of the above-mentioned model training method embodiment when executed by the processor.

相应的,本发明实施例公开了一种计算机可读存储介质,所述计算机可读存储介质上存储计算机程序,所述计算机程序被处理器执行时实现上述模型训练方法实施例的各个步骤。Correspondingly, an embodiment of the present invention discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various steps of the above-mentioned model training method embodiment are implemented.

本发明实施例包括以下优点:The embodiments of the present invention include the following advantages:

本发明实施例提供的一种部署服务器集群的方法,通过预设的预启动执行环境服务器,对预设数量的设备部署服务器操作系统,并将部署所述服务器操作系统的设备作为中心节点服务器,然后获取中心节点服务器的设备信息,根据中心节点服务器的设备信息,确定中心节点服务器对待处理设备部署服务器操作系统时,允许同时部署的设备数量,再根据中心节点服务器允许同时部署的设备数量,对待处理设备部署服务器操作系统。本发明实施例在部署预设数量的中心节点服务器之后,通过预设数量的中心节点服务器对待处理设备部署服务器操作系统,从而避免了使用单台预启动执行环境服务器提供网络启动服务和操作系统镜像进行服务器集群部署,在网络中断或不稳定时导致的部署失败,从而提高了服务器集群部署的稳定性和效率。A method for deploying a server cluster provided by an embodiment of the present invention deploys a server operating system to a preset number of devices through a preset pre-start execution environment server, and uses the device on which the server operating system is deployed as a central node server, then obtains device information of the central node server, determines the number of devices that the central node server allows to be deployed simultaneously when deploying the server operating system to the device to be processed based on the device information of the central node server, and then deploys the server operating system to the device to be processed based on the number of devices that the central node server allows to be deployed simultaneously. After deploying a preset number of central node servers, the embodiment of the present invention deploys the server operating system to the device to be processed through a preset number of central node servers, thereby avoiding the use of a single pre-start execution environment server to provide network startup services and operating system images for server cluster deployment, which causes deployment failures when the network is interrupted or unstable, thereby improving the stability and efficiency of server cluster deployment.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1是本发明实施例的一种部署服务器集群的方法的步骤流程图;FIG1 is a flow chart of steps of a method for deploying a server cluster according to an embodiment of the present invention;

图2是本发明实施例的一种部署服务器集群的装置的结构框图;FIG2 is a structural block diagram of an apparatus for deploying a server cluster according to an embodiment of the present invention;

图3是本发明实施例的一种电子设备的结构框图;FIG3 is a block diagram of an electronic device according to an embodiment of the present invention;

图4是本发明实施例的一种计算机可读存储介质的结构框图。FIG. 4 is a structural block diagram of a computer-readable storage medium according to an embodiment of the present invention.

具体实施方式DETAILED DESCRIPTION

为使本发明的上述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本发明作进一步详细的说明。In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

在实际应用中,现有技术使用PXE部署服务器集群时,只有一台PXE服务器来提供网络启动服务和操作系统镜像,在网络中的客户端数量非常多,或者网络带宽有限的情况下,任何网络中断或不稳定都可能导致部署失败,这种部署服务器集群的方式不够稳定可靠。In actual applications, when the existing technology uses PXE to deploy a server cluster, there is only one PXE server to provide network boot services and operating system images. When there are a large number of clients in the network or the network bandwidth is limited, any network interruption or instability may cause deployment failure. This method of deploying a server cluster is not stable and reliable enough.

本发明实施例的核心构思之一在于,本发明实施例在部署预设数量的中心节点服务器之后,通过预设数量的中心节点服务器对待处理设备部署服务器操作系统,从而避免了使用单台预启动执行环境服务器提供网络启动服务和操作系统镜像进行服务器集群部署,在网络中断或不稳定时导致的部署失败,从而提高了服务器集群部署的稳定性和效率。One of the core concepts of an embodiment of the present invention is that after deploying a preset number of central node servers, the embodiment of the present invention deploys a server operating system on the processing device through a preset number of central node servers, thereby avoiding the use of a single pre-boot execution environment server to provide network boot services and operating system images for server cluster deployment, and the deployment failure caused by network interruption or instability, thereby improving the stability and efficiency of server cluster deployment.

参照图1,示出了本发明实施例的部署服务器集群的方法的步骤流程图,具体可以包括如下步骤:1 , a flow chart of the steps of a method for deploying a server cluster according to an embodiment of the present invention is shown, which may specifically include the following steps:

步骤101,通过预设的预启动执行环境服务器,对预设数量的设备部署服务器操作系统,并将部署所述服务器操作系统的设备作为中心节点服务器。Step 101, deploying a server operating system to a preset number of devices through a preset pre-start execution environment server, and using the devices on which the server operating system is deployed as central node servers.

具体而言,利用PXE技术部署操作系统是一种高效的网络引导方案,它允许计算机通过网络接口卡启动并安装操作系统。使用PXE技术部署操作系统的流程如下:Specifically, using PXE technology to deploy an operating system is an efficient network boot solution that allows a computer to start and install an operating system through a network interface card. The process of using PXE technology to deploy an operating system is as follows:

1、环境准备:在批量部署Linux系统之前,需要确保网络环境满足要求。所有目标机器必须连接到局域网(LAN),并且网络配置应允许DHCP(Dynamic Host ConfigurationProtocol,动态主机配置协议)和TFTP(Trivial File Transfer Protocol,简单文件传输协议)通信。这意味着网络交换机和路由器需要正确设置,以允许这些服务的数据包通过。同时,需要准备一台或多台服务器,分别用于运行DHCP、TFTP和HTTP(Hypertext TransferProtocol,超文本传输协议)/FTP(File Transfer Protocol,文件传输协议)服务。1. Environment preparation: Before batch deployment of Linux systems, you need to ensure that the network environment meets the requirements. All target machines must be connected to the local area network (LAN), and the network configuration should allow DHCP (Dynamic Host Configuration Protocol) and TFTP (Trivial File Transfer Protocol) communications. This means that network switches and routers need to be correctly set up to allow data packets for these services to pass through. At the same time, you need to prepare one or more servers to run DHCP, TFTP, and HTTP (Hypertext Transfer Protocol)/FTP (File Transfer Protocol) services.

2、安装和配置DHCP服务器:DHCP服务器是PXE网络引导过程的关键组件,它负责为网络中的计算机分配IP地址。安装DHCP服务器软件后,需要创建一个新的作用域,这个作用域将包含用于PXE客户端的IP地址池。此外,还需配置DHCP选项,指定TFTP服务器的IP地址和PXE启动文件的名称,以便客户端能够找到并下载启动文件。2. Install and configure the DHCP server: The DHCP server is a key component of the PXE network boot process. It is responsible for assigning IP addresses to computers on the network. After installing the DHCP server software, you need to create a new scope that will contain the IP address pool for the PXE client. In addition, you need to configure the DHCP options to specify the IP address of the TFTP server and the name of the PXE boot file so that the client can find and download the boot file.

3、安装和配置TFTP服务器:TFTP服务器用于在网络启动过程中传输PXE启动文件。安装TFTP服务器软件,并设置TFTP根目录,这是TFTP服务器上存储PXE启动文件的位置。确保此目录对于DHCP服务器是可访问的。然后,将PXE启动文件(如undionly.kpxe)上传到TFTP根目录。3. Install and configure the TFTP server: The TFTP server is used to transfer the PXE boot file during the network boot process. Install the TFTP server software and set the TFTP root directory, which is the location on the TFTP server where the PXE boot file is stored. Make sure this directory is accessible to the DHCP server. Then, upload the PXE boot file (such as undivided.kpxe) to the TFTP root directory.

4、安装和配置HTTP/FTP服务器:HTTP/FTP服务器用于存储Linux安装镜像和PXE启动脚本。安装相应的服务器软件,并设置一个共享目录,用于存放操作系统的安装介质。上传操作系统的安装镜像文件到这个目录,以便于PXE启动脚本可以从这里下载所需的安装文件。4. Install and configure HTTP/FTP server: HTTP/FTP server is used to store Linux installation images and PXE boot scripts. Install the corresponding server software and set up a shared directory to store the operating system installation media. Upload the operating system installation image file to this directory so that the PXE boot script can download the required installation files from here.

5、创建PXE启动脚本:PXE启动脚本是指导PXE客户端如何启动和安装操作系统的配置文件。使用文本编辑器创建启动脚本,如pxelinux.cfg/default文件,其中应包含指向Linux内核和初始ramdisk(内存磁盘)的HTTP/FTP URL,以及任何需要传递给内核的安装参数。创建后,将此脚本上传到HTTP/FTP服务器的安装目录。5. Create a PXE boot script: The PXE boot script is a configuration file that instructs the PXE client on how to boot and install the operating system. Use a text editor to create a boot script, such as the pxelinux.cfg/default file, which should contain the HTTP/FTP URL pointing to the Linux kernel and the initial ramdisk (memory disk), as well as any installation parameters that need to be passed to the kernel. After creation, upload this script to the installation directory of the HTTP/FTP server.

6、配置BIOS(Basic Input/Output System,基本输入/输出系统)/UEFI(UnifiedExtensible Firmware Interface,统一可扩展固件接口)设置:在目标机器上,进入BIOS/UEFI设置界面,将网络接口卡设置为首选启动设备。这样,当计算机启动时,它将首先尝试通过网络接口卡启动,而不是依赖本地存储设备。6. Configure BIOS (Basic Input/Output System)/UEFI (Unified Extensible Firmware Interface) settings: On the target machine, enter the BIOS/UEFI settings interface and set the network interface card as the preferred boot device. In this way, when the computer starts, it will first try to boot through the network interface card instead of relying on local storage devices.

7、启动和部署:在BIOS/UEFI设置中完成配置后,重启目标机器。它们将通过网络启动,从DHCP服务器获取IP地址,从TFTP服务器下载PXE启动文件,并最终从HTTP/FTP服务器加载Linux安装器。7. Boot and deploy: After completing the configuration in the BIOS/UEFI settings, reboot the target machines. They will boot over the network, obtain IP addresses from the DHCP server, download PXE boot files from the TFTP server, and finally load the Linux installer from the HTTP/FTP server.

8、自定义和自动化:为了实现无人值守的自动安装,可以创建自动化安装脚本,如Kickstart文件,它自动完成操作系统的安装和配置。同时,根据硬件配置和网络环境调整PXE启动脚本和DHCP设置,以确保安装过程的顺利进行。8. Customization and Automation: To achieve unattended automatic installation, you can create automated installation scripts, such as Kickstart files, which automatically complete the installation and configuration of the operating system. At the same time, adjust the PXE startup script and DHCP settings according to the hardware configuration and network environment to ensure a smooth installation process.

9、安全和维护:确保所有服务器使用强密码,并只对受信任的客户端开放相应服务。定期检查并更新BIOS/UEFI和网络接口卡的固件,以利用最新的安全修复和性能改进。9. Security and maintenance: Ensure that all servers use strong passwords and only open corresponding services to trusted clients. Regularly check and update the firmware of BIOS/UEFI and network interface cards to take advantage of the latest security fixes and performance improvements.

10、监控和日志:配置服务器以记录PXE部署过程中的所有相关活动。使用网络监控工具跟踪PXE部署的状态,确保所有客户端都能成功启动和安装。10. Monitoring and logging: Configure the server to log all relevant activities during the PXE deployment process. Use network monitoring tools to track the status of the PXE deployment to ensure that all clients can successfully start and install.

11、验证和测试:在正式推广之前,先在一台或几台目标机器上测试PXE启动和安装过程,确保一切按预期工作。测试成功后,逐步将PXE启动和安装推广到所有目标机器。11. Verification and testing: Before the official promotion, test the PXE boot and installation process on one or several target machines to ensure that everything works as expected. After the test is successful, gradually promote PXE boot and installation to all target machines.

上述使用PXE技术部署操作系统的流程存在如下问题:The above process of using PXE technology to deploy the operating system has the following problems:

网络依赖性:PXE部署对网络稳定性要求极高,因为它依赖于网络来传输启动文件和操作系统镜像。任何网络中断或不稳定都可能导致部署失败,特别是在大规模部署时,网络流量的管理变得尤为重要。DHCP服务的兼容性:DHCP服务负责为PXE客户端分配必要的网络参数,包括告知客户端TFTP服务器的位置。不同DHCP服务器的配置差异可能导致PXE客户端无法获取正确的启动文件路径,从而阻碍部署过程。启动文件大小限制:PXE通过TFTP传输启动文件,而TFTP协议对传输文件大小有限制。这意味着大型的操作系统镜像可能需要分割或压缩,以适应网络传输的限制,这增加了部署的复杂性。安全性问题:TFTP协议不支持数据加密,这使得PXE部署在安全性上存在风险。未加密的传输可能导致敏感数据泄露,或启动文件被恶意篡改,对系统的安全性构成威胁。硬件兼容性:PXE启动要求网络接口卡(NIC)支持网络启动,但并非所有硬件都提供此功能。此外,不同的硬件可能需要特定的驱动程序或固件支持,限制了PXE部署的通用性。系统复杂性:PXE部署涉及多个组件,包括DHCP、TFTP、HTTP/FTP服务器以及客户端的BIOS/UEFI设置。这些组件需要精确配置,任何组件的配置错误都可能导致整个部署过程失败。维护和升级:随着操作系统和PXE相关软件的更新,维护和升级变得必要。这要求IT管理员不断更新PXE环境,以确保部署过程的持续有效性。性能瓶颈:在大规模部署时,服务器的计算能力和网络带宽可能成为限制因素。大量的PXE客户端同时请求数据可能导致服务器响应缓慢,影响部署速度。错误处理和恢复:PXE部署过程中的错误可能难以诊断,如TFTP服务器无法访问或启动文件损坏。恢复过程可能需要手动检查配置、替换文件或重启服务。环境适应性:PXE部署需要适应不同的网络环境和硬件配置。在不同的物理位置或网络架构中部署时,可能需要特定的调整,如VLAN设置或不同的网络协议支持。跨平台支持:PXE部署需要在不同的硬件和操作系统平台上工作,这可能要求为不同的平台准备不同的启动文件和配置,增加了部署的复杂性。用户干预:在某些情况下,自动化的PXE部署可能无法处理所有情况,如特定硬件的驱动问题或自定义操作系统需求,这时可能需要管理员手动干预。硬件故障和替换:硬件故障可能导致PXE部署中断,而替换硬件后,可能需要重新配置PXE环境,以确保新硬件能够成功启动,这增加了维护成本。数据完整性验证:PXE部署过程中需要确保传输的数据未被篡改。缺乏数据完整性验证机制可能导致部署失败或启动不安全的系统,需要额外的机制来确保数据的准确性。软件栈的集成:PXE部署需要与现有的系统管理工具和软件栈集成,如配置管理工具、监控系统等。这可能需要开发定制的集成脚本或使用第三方解决方案,增加了部署的复杂性。Network dependency: PXE deployment requires extremely high network stability because it relies on the network to transfer boot files and operating system images. Any network interruption or instability may cause deployment failure, especially in large-scale deployment, the management of network traffic becomes particularly important. DHCP service compatibility: The DHCP service is responsible for allocating necessary network parameters to the PXE client, including informing the client of the location of the TFTP server. Differences in the configuration of different DHCP servers may cause the PXE client to be unable to obtain the correct boot file path, thus hindering the deployment process. Boot file size limit: PXE transfers boot files through TFTP, and the TFTP protocol has a limit on the size of the transferred file. This means that large operating system images may need to be split or compressed to fit the limitations of network transmission, which increases the complexity of deployment. Security issues: The TFTP protocol does not support data encryption, which makes PXE deployment risky in terms of security. Unencrypted transmission may lead to the leakage of sensitive data, or malicious tampering of boot files, posing a threat to the security of the system. Hardware compatibility: PXE boot requires the network interface card (NIC) to support network boot, but not all hardware provides this function. In addition, different hardware may require specific driver or firmware support, limiting the versatility of PXE deployment. System complexity: PXE deployment involves multiple components, including DHCP, TFTP, HTTP/FTP servers, and BIOS/UEFI settings on the client. These components need to be precisely configured, and misconfiguration of any component may cause the entire deployment process to fail. Maintenance and upgrades: With updates to the operating system and PXE-related software, maintenance and upgrades become necessary. This requires IT administrators to continuously update the PXE environment to ensure the continued effectiveness of the deployment process. Performance bottlenecks: In large-scale deployments, the computing power and network bandwidth of the server may become limiting factors. A large number of PXE clients requesting data at the same time may cause the server to respond slowly, affecting the deployment speed. Error handling and recovery: Errors during the PXE deployment process may be difficult to diagnose, such as the TFTP server being inaccessible or the boot file being damaged. The recovery process may require manual configuration checks, file replacements, or service restarts. Environmental adaptability: PXE deployment needs to adapt to different network environments and hardware configurations. When deployed in different physical locations or network architectures, specific adjustments may be required, such as VLAN settings or different network protocol support. Cross-platform support: PXE deployment needs to work on different hardware and operating system platforms, which may require different boot files and configurations to be prepared for different platforms, increasing the complexity of deployment. User intervention: In some cases, automated PXE deployment may not be able to handle all situations, such as driver issues for specific hardware or custom operating system requirements, which may require manual intervention by the administrator. Hardware failure and replacement: Hardware failure may cause PXE deployment to be interrupted, and after replacing the hardware, the PXE environment may need to be reconfigured to ensure that the new hardware can be successfully started, which increases maintenance costs. Data integrity verification: During the PXE deployment process, it is necessary to ensure that the transmitted data has not been tampered with. The lack of a data integrity verification mechanism may result in deployment failure or the startup of an unsafe system, and additional mechanisms are required to ensure the accuracy of the data. Integration of software stacks: PXE deployment needs to be integrated with existing system management tools and software stacks, such as configuration management tools, monitoring systems, etc. This may require the development of customized integration scripts or the use of third-party solutions, increasing the complexity of deployment.

本发明实施例通过预设的预启动执行环境服务器,也就是预设的PXE服务器,对预设数量的设备部署服务器操作系统,并将部署服务器操作系统的设备作为中心节点服务器,示例性地,预设数量可以为10个,通过1个预设的PXE服务器,对10个设备部署服务器操作系统,得到10个部署完成的服务器,将这10个部署完成的服务器作为中心服务器。当然,预设数量可以在实际应用中,根据实际需求进行设置,本发明实施例对此不作限制。The embodiment of the present invention deploys the server operating system to a preset number of devices through a preset pre-boot execution environment server, that is, a preset PXE server, and uses the device on which the server operating system is deployed as a central node server. For example, the preset number can be 10. Through 1 preset PXE server, the server operating system is deployed to 10 devices, and 10 deployed servers are obtained, and these 10 deployed servers are used as central servers. Of course, the preset number can be set according to actual needs in actual applications, and the embodiment of the present invention does not limit this.

步骤102,获取所述中心节点服务器的设备信息。Step 102: Obtain device information of the central node server.

示例性地,若中心节点服务器的数量为10个,获取10个中心节点服务器的设备信息。Exemplarily, if the number of central node servers is 10, the device information of the 10 central node servers is obtained.

步骤103,根据所述中心节点服务器的设备信息,确定所述中心节点服务器对待处理设备部署服务器操作系统时,允许同时部署的设备数量。Step 103: Determine, based on the device information of the central node server, the number of devices that the central node server is allowed to deploy simultaneously when deploying the server operating system on the devices to be processed.

具体而言,若中心节点服务器的数量为10个,根据这10个中心节点服务器的设备信息,确定各个中心节点服务器对待处理设备部署服务器操作系统时,允许同时部署的设备数量,其中,允许同时部署的设备数量也就是在中心节点服务器在性能最优的情况下,适合同时部署的设备数量,当然,中心节点服务器在性能最优的情况下适合同时部署的设备数量,小于中心节点服务器能够同时部署的最大设备数量,示例性地,中心节点服务器A能够同时部署的最大设备数量为200台,在处理性能最优的情况下适合同时部署的设备数量为15台。Specifically, if the number of central node servers is 10, the number of devices allowed to be deployed simultaneously when each central node server deploys the server operating system on the processing device is determined based on the device information of these 10 central node servers. The number of devices allowed to be deployed simultaneously is that the number of devices that are suitable for simultaneous deployment when the central node server has optimal performance. Of course, the number of devices that are suitable for simultaneous deployment when the central node server has optimal performance is less than the maximum number of devices that can be deployed simultaneously by the central node server. For example, the maximum number of devices that can be deployed simultaneously by the central node server A is 200, and the number of devices that are suitable for simultaneous deployment when the processing performance is optimal is 15.

步骤104,根据所述中心节点服务器允许同时部署的设备数量,对所述待处理设备部署服务器操作系统。Step 104: deploy a server operating system to the device to be processed according to the number of devices that the central node server allows to be deployed simultaneously.

具体而言,在确定各个中心节点服务器允许同时部署的设备数量后,根据各个中心节点服务器允许同时部署的设备数量,通过中心节点服务器对待处理设备部署服务器操作系统。Specifically, after determining the number of devices that each central node server allows to be deployed simultaneously, the server operating system is deployed on the device to be processed through the central node server according to the number of devices that each central node server allows to be deployed simultaneously.

本发明实施例提供的一种部署服务器集群的方法,通过预设的预启动执行环境服务器,对预设数量的设备部署服务器操作系统,并将部署所述服务器操作系统的设备作为中心节点服务器,然后获取中心节点服务器的设备信息,根据中心节点服务器的设备信息,确定中心节点服务器对待处理设备部署服务器操作系统时,允许同时部署的设备数量,再根据中心节点服务器允许同时部署的设备数量,对待处理设备部署服务器操作系统。本发明实施例在部署预设数量的中心节点服务器之后,通过预设数量的中心节点服务器对待处理设备部署服务器操作系统,从而避免了使用单台预启动执行环境服务器提供网络启动服务和操作系统镜像进行服务器集群部署,在网络中断或不稳定时导致的部署失败,从而提高了服务器集群部署的稳定性和效率。A method for deploying a server cluster provided by an embodiment of the present invention deploys a server operating system to a preset number of devices through a preset pre-start execution environment server, and uses the device on which the server operating system is deployed as a central node server, then obtains device information of the central node server, determines the number of devices that the central node server allows to be deployed simultaneously when deploying the server operating system to the device to be processed based on the device information of the central node server, and then deploys the server operating system to the device to be processed based on the number of devices that the central node server allows to be deployed simultaneously. After deploying a preset number of central node servers, the embodiment of the present invention deploys the server operating system to the device to be processed through a preset number of central node servers, thereby avoiding the use of a single pre-start execution environment server to provide network startup services and operating system images for server cluster deployment, which causes deployment failures when the network is interrupted or unstable, thereby improving the stability and efficiency of server cluster deployment.

在本发明实施例中,所述预设的预启动执行环境服务器包括容器镜像,所述容器镜像包括所述服务器操作系统镜像;步骤101所述通过预设的预启动执行环境服务器,对预设数量的设备部署服务器操作系统,具体可以包括如下子步骤:In an embodiment of the present invention, the preset pre-boot execution environment server includes a container image, and the container image includes the server operating system image; the step 101 deploys the server operating system to a preset number of devices through the preset pre-boot execution environment server, which may specifically include the following sub-steps:

子步骤S11,将所述预设的预启动执行环境服务器的所述容器镜像;分别发送至所述预设数量的设备。Sub-step S11: sending the container image of the preset pre-start execution environment server to the preset number of devices respectively.

具体而言,选择一个服务器操作系统的基础镜像,如官方的Ubuntu、CentOS或Debian镜像,基础镜像可以根据实际情况进行选择,本发明实施例对此不作限制。Specifically, a basic image of a server operating system is selected, such as an official Ubuntu, CentOS or Debian image. The basic image can be selected according to actual conditions, and the embodiment of the present invention does not limit this.

确定服务器操作系统的基础镜像后,编写Dockerfile,通过编写一个Dockerfile来定制Linux安装器的Docker镜像,Dockerfile将包含所有必要的命令来安装系统、配置网络和安装所需的软件。Dockerfile是一个文本文件,它包含了一系列的指令和参数,用于自动化构建Docker容器镜像,通过Dockerfile,开发者可以定义容器镜像的基础操作系统、安装的软件、环境变量、工作目录、对外暴露的端口、容器启动时要执行的命令等。After determining the base image of the server operating system, write a Dockerfile. By writing a Dockerfile to customize the Docker image of the Linux installer, the Dockerfile will contain all the necessary commands to install the system, configure the network, and install the required software. Dockerfile is a text file that contains a series of instructions and parameters for automatically building Docker container images. Through Dockerfile, developers can define the base operating system of the container image, installed software, environment variables, working directory, exposed ports, commands to be executed when the container is started, etc.

以下为一个Dockerfile的示例代码:The following is a sample code of a Dockerfile:

#使用官方的Ubuntu基础镜像#Use the official Ubuntu base image

FROM ubuntu:20.04FROM ubuntu:20.04

#设置维护者信息#Set maintainer information

LABEL maintainer="yourname@example.com"LABEL maintainer="yourname@example.com"

#安装必要的软件包#Install necessary packages

RUN apt-get update&&\RUN apt-get update&&\

apt-get install-y openssh-server curlapt-get install-y openssh-server curl

#配置SSH服务#Configure SSH service

RUN mkdir/var/run/sshdRUN mkdir /var/run/sshd

RUN echo'root:password'|chpasswdRUN echo'root:password'|chpasswd

RUN sed-i's/#PermitRootLogin prohibit-password/PermitRootLogin yes/'/etc/ssh/sshd_configRUN sed-i's/#PermitRootLogin prohibit-password/PermitRootLogin yes/'/etc/ssh/sshd_config

#SSH登录时不进行严格的key检查,方便复制文件#SSH login does not perform strict key checking, which makes it easier to copy files

RUN sed-i's/#StrictHostKeyChecking ask/StrictHostKeyChecking no/'/etc/ssh/ssh_configRUN sed-i's/#StrictHostKeyChecking ask/StrictHostKeyChecking no/'/etc/ssh/ssh_config

#开放SSH端口#Open SSH port

EXPOSE 22EXPOSE 22

#启动SSH服务#Start SSH service

CMD["/usr/sbin/sshd","-D"]CMD["/usr/sbin/sshd","-D"]

编写完Dockerfile后,通过Dockerfile构建一个定制的容器镜像,并将其推送到本地的镜像仓库中,以便其他节点可以拉取和使用。对镜像仓库进行配置,并确保所有部署节点都具有访问权限。镜像仓库(Docker Registry)是一个存储和分发Docker镜像的服务,它允许用户上传(push)和下载(pull)Docker镜像,以便在不同的机器或环境中部署和运行。After writing the Dockerfile, build a customized container image through the Dockerfile and push it to the local image repository so that other nodes can pull and use it. Configure the image repository and ensure that all deployment nodes have access rights. The image repository (Docker Registry) is a service for storing and distributing Docker images. It allows users to upload (push) and download (pull) Docker images for deployment and running on different machines or environments.

在构建好容器镜像后,编写部署脚本,通过部署脚本启动Docker容器,并配置必要的参数,如网络设置、存储卷等。After building the container image, write a deployment script, use the deployment script to start the Docker container, and configure necessary parameters, such as network settings, storage volumes, etc.

以下为运行部署脚本的示例代码:The following is a sample code for running the deployment script:

#!/bin/bash#!/bin/bash

docker run-d--name linux-installer--privileged\docker run-d --name linux-installer --privileged\

-v/path/to/ssh_keys:/root/.ssh\-v/path/to/ssh_keys:/root/.ssh\

-v/path/to/install/scripts:/install_scripts\-v/path/to/install/scripts:/install_scripts\

my-linux-installermy-linux-installer

在本发明实施例中,预设的预启动执行环境服务器包括容器镜像,容器镜像为上述步骤中通过Dockerfile构建的容器镜像,容器镜像包括服务器操作系统镜像,将预设的预启动执行环境服务器的所述容器镜像分别发送至预设数量的设备。In an embodiment of the present invention, the preset pre-start execution environment server includes a container image, which is the container image built by Dockerfile in the above steps, and the container image includes a server operating system image. The container image of the preset pre-start execution environment server is sent to a preset number of devices respectively.

子步骤S12,启动所述预设数量的设备中的容器镜像,对预设数量的设备部署服务器操作系统。Sub-step S12, starting the container images in the preset number of devices, and deploying the server operating system on the preset number of devices.

具体而言,获取预设的预启动执行环境服务器中的部署脚本,通过部署脚本启动预设数量的设备中的容器镜像,对预设数量的设备部署服务器操作系统。这些容器将作为轻量级的Linux安装器运行。利用Docker的内置服务发现机制或结合额外的工具(如etcd或Consul)实现节点间的自动发现,为后续的P2P(Peer-to-Peer,对等节点)部署打下基础。Specifically, the deployment script in the preset pre-start execution environment server is obtained, and the container images in the preset number of devices are started through the deployment script, and the server operating system is deployed to the preset number of devices. These containers will run as lightweight Linux installers. Automatic discovery between nodes is achieved by using Docker's built-in service discovery mechanism or in combination with additional tools (such as etcd or Consul), laying the foundation for subsequent P2P (Peer-to-Peer, peer-to-peer) deployment.

通过容器镜像部署服务器操作系统,容器间通信可以通过加密通道进行,增强了数据传输的安全性,并且,容器镜像可以在多种硬件上运行,减少了对特定硬件的依赖,而且,容器化简化了部署流程,降低了系统复杂性,使得部署和管理更加直观,另外,容器化部署便于维护和升级,可以直接替换容器镜像,无需复杂的系统更新。By deploying server operating systems through container images, communication between containers can be carried out through encrypted channels, which enhances the security of data transmission. In addition, container images can run on a variety of hardware, reducing dependence on specific hardware. Moreover, containerization simplifies the deployment process, reduces system complexity, and makes deployment and management more intuitive. In addition, containerized deployment facilitates maintenance and upgrades, and container images can be directly replaced without complex system updates.

在本发明实施例中,所述中心节点服务器的所述设备信息包括中央处理器性能、内存大小、存储速度、当前负载或网络带宽至少一种;步骤103所述根据所述中心节点服务器的设备信息,确定所述中心节点服务器对待处理设备部署服务器操作系统时,允许同时部署的设备数量,具体可以包括如下步骤:In an embodiment of the present invention, the device information of the central node server includes at least one of central processing unit performance, memory size, storage speed, current load or network bandwidth; step 103 determines the number of devices that the central node server allows to be deployed simultaneously when deploying a server operating system on a device to be processed according to the device information of the central node server, which may specifically include the following steps:

根据所述中心节点服务器的中央处理器性能、内存大小、存储速度、当前负载或网络带宽至少一种,确定所述中心节点服务器对待处理设备部署服务器操作系统时,允许同时部署的设备数量。The number of devices that are allowed to be deployed simultaneously when the central node server deploys a server operating system on the processed devices is determined based on at least one of the central processing unit performance, memory size, storage speed, current load or network bandwidth of the central node server.

具体而言,根据各个中心节点服务器的中央处理器性能、内存大小、存储速度、当前负载或网络带宽至少一种,确定各个中心节点服务器对待处理设备部署服务器操作系统时,允许同时部署的设备数量,示例性地,中央处理器性能好、内存大、负载低的中心节点服务器,对待处理设备部署服务器操作系统时,允许同时部署的设备数量更多,也可以将所述中心节点服务器对待处理设备部署服务器操作系统时,允许同时部署的设备数量,看作所述中心节点服务器的权重,权重也就是允许同时部署的设备数量。Specifically, based on the central processing unit performance, memory size, storage speed, current load or network bandwidth of each central node server, the number of devices allowed to be deployed simultaneously when each central node server deploys the server operating system on the processing device is determined. For example, a central node server with good central processing unit performance, large memory and low load allows more devices to be deployed simultaneously when the server operating system is deployed on the processing device. The number of devices allowed to be deployed simultaneously when the central node server deploys the server operating system on the processing device can also be regarded as the weight of the central node server, and the weight is the number of devices allowed to be deployed simultaneously.

通过各个中心节点服务器的中央处理器性能、内存大小、存储速度、当前负载或网络带宽至少一种,确定各个中心节点服务器允许同时部署的设备数量,能够合理的利用各个中心节点服务器进行部署,效率更高。By determining the number of devices allowed to be deployed simultaneously on each central node server through at least one of the central processor performance, memory size, storage speed, current load or network bandwidth of each central node server, each central node server can be reasonably utilized for deployment with higher efficiency.

在本发明实施例中,步骤104所述根据所述中心节点服务器允许同时部署的设备数量,对所述待处理设备部署服务器操作系统,包括:In the embodiment of the present invention, the step 104 deploys the server operating system on the device to be processed according to the number of devices that the central node server allows to be deployed simultaneously, including:

子步骤S21,确定所有的所述中心节点服务器允许同时部署的设备数量的总数量。Sub-step S21, determining the total number of devices that are allowed to be deployed simultaneously on all the central node servers.

具体而言,如下为所述中心节点服务器允许同时部署的设备数量的示例代码:Specifically, the following is a sample code for the number of devices that the central node server allows to be deployed simultaneously:

#假设有10个节点,它们的性能权重如下:#Assume there are 10 nodes, and their performance weights are as follows:

nodes=['Node1','Node2','Node3','Node4','Node5','Node6','Node7','Node8','Node9','Node10']nodes=['Node1','Node2','Node3','Node4','Node5','Node6','Node7','Node8','Node9','Node10']

weights=[10,1,1,1,1,1,9,1,1,1]#示例权重,实际情况会更复杂weights = [10,1,1,1,1,1,9,1,1,1] # Example weights, the actual situation will be more complicated

示例性地,中心节点服务器的数量为10个,所有的中心节点服务器允许同时部署的设备数量为10+1+1+1+1+1+9+1+1+1=27。Exemplarily, the number of central node servers is 10, and the number of devices that can be deployed simultaneously on all the central node servers is 10+1+1+1+1+1+9+1+1+1=27.

子步骤S22,比较所述待处理设备的数量与所述总数量。Sub-step S22, comparing the number of the devices to be processed with the total number.

具体而言,将待处理设备的数量,也就是需要进行部署服务器的设备的数量,与总数量进行比较。Specifically, the number of pending devices, that is, the number of devices that need to deploy servers, is compared with the total number.

子步骤S23,在所述待处理设备的数量等于所述总数量时,通过所有的所述中心节点服务器,对所述待处理设备部署服务器操作系统。Sub-step S23, when the number of the devices to be processed is equal to the total number, deploying a server operating system to the devices to be processed through all the central node servers.

具体而言,接上例,若待处理设备的数量与为27,那么,所有的中心节点服务器允许同时部署的设备数量的总数量与待处理设备的数量相同,让10个中心节点按照允许同时部署的数量同时进行部署。Specifically, continuing with the previous example, if the number of devices to be processed is 27, then the total number of devices that all central node servers allow to be deployed simultaneously is the same as the number of devices to be processed, allowing 10 central nodes to be deployed simultaneously according to the number of devices allowed to be deployed simultaneously.

子步骤S24,在所述待处理设备的数量小于所述总数量时,根据各个所述中心节点服务器允许同时部署的设备数量,确定目标中心节点服务器,通过所述目标中心节点服务器对所述待处理设备部署服务器操作系统。Sub-step S24, when the number of the devices to be processed is less than the total number, determine the target central node server according to the number of devices allowed to be deployed simultaneously by each central node server, and deploy the server operating system to the devices to be processed through the target central node server.

接上例,若待处理设备的数量为19,那么,所有的中心节点服务器允许同时部署的设备数量的总数量大于待处理设备的数量,选用允许同时部署的数量最高的两个中心节点服务器,这两个中心节点服务器,一个允许同时部署的数量为10,一个允许同时部署的数量为9,正好使用这两个中心节点服务器,能够部署的待处理设备的数量为19,确定这两个中心节点服务器为目标中心节点服务器,通过目标中心节点服务器对待处理设备部署服务器操作系统。Continuing with the previous example, if the number of devices to be processed is 19, then the total number of devices allowed to be deployed simultaneously by all central node servers is greater than the number of devices to be processed. The two central node servers with the highest number of devices allowed to be deployed simultaneously are selected. One of these two central node servers allows 10 devices to be deployed simultaneously, and the other allows 9 devices to be deployed simultaneously. Using these two central node servers, the number of devices to be deployed that can be processed is 19. These two central node servers are determined as the target central node servers, and the server operating system is deployed on the devices to be processed through the target central node servers.

子步骤S25,在所述待处理设备的数量大于所述总数量时,根据每个所述中心节点服务器允许同时部署的设备数量,使每个所述中心节点服务器同时对对应数量的待处理设备部署服务器操作系统;以及每当所述中心节点服务器完成对待处理设备部署服务器操作系统的操作后,从剩余的待处理设备确定所述中心节点服务器所需处理的待处理设备并对所述所需处理的待处理设备部署服务器操作系统。Sub-step S25, when the number of the devices to be processed is greater than the total number, based on the number of devices that each of the central node servers is allowed to deploy simultaneously, each of the central node servers simultaneously deploys the server operating system to the corresponding number of devices to be processed; and whenever the central node server completes the operation of deploying the server operating system to the devices to be processed, the devices to be processed that the central node server needs to process are determined from the remaining devices to be processed and the server operating system is deployed to the devices to be processed that need to be processed.

具体而言,若待处理设备的数量为40,那么,所有的中心节点服务器允许同时部署的设备数量的总数量小于待处理设备的数量,根据每个中心节点服务器允许同时部署的设备数量,使每个中心节点服务器同时对对应数量的待处理设备部署服务器操作系统,也就是10个中心节点同时能够先部署27个,每当中心节点服务器完成对待处理设备部署服务器操作系统的操作后,从剩余的待处理设备确定中心节点服务器所需处理的待处理设备,并对所述所需处理的待处理设备部署服务器操作系统,例如允许同时部署的设备数量为10的中心节点服务器完成2个待处理设备的部署后,再从剩余的待处理设备,分2个待处理设备给这个中心节点服务器。Specifically, if the number of devices to be processed is 40, then the total number of devices that all central node servers are allowed to deploy simultaneously is less than the number of devices to be processed. According to the number of devices that each central node server is allowed to deploy simultaneously, each central node server deploys the server operating system to the corresponding number of devices to be processed at the same time, that is, 10 central nodes can deploy 27 at the same time. Whenever the central node server completes the operation of deploying the server operating system on the devices to be processed, the central node server determines the devices to be processed that need to be processed from the remaining devices to be processed, and deploys the server operating system to the devices to be processed. For example, after the central node server that allows 10 devices to be deployed simultaneously completes the deployment of 2 devices to be processed, 2 devices to be processed are allocated to this central node server from the remaining devices to be processed.

示例性地,可以使用Docker Swarm或Kubernetes等容器编排工具,自动分配部署任务到不同的节点,实现负载均衡,避免单个节点过载。通过中心节点服务器动态的分配待处理设备,能够实现负载均衡,避免单个节点过载,提高效率和稳定性。For example, container orchestration tools such as Docker Swarm or Kubernetes can be used to automatically distribute deployment tasks to different nodes to achieve load balancing and avoid overloading of a single node. By dynamically allocating devices to be processed through the central node server, load balancing can be achieved, overloading of a single node can be avoided, and efficiency and stability can be improved.

在本发明实施例中,所述中心节点服务器和所述待处理设备配置有服务发现,所述通过所有的所述中心节点服务器,对所述待处理设备部署服务器操作系统,包括:In the embodiment of the present invention, the central node server and the device to be processed are configured with service discovery, and the server operating system is deployed on the device to be processed through all the central node servers, including:

针对各个所述待处理设备,确定距离所述待处理设备最近的中心节点服务器。For each of the devices to be processed, determine the central node server closest to the device to be processed.

通过所述距离所述待处理设备最近的中心节点服务器,对所述待处理设备部署服务器操作系统。A server operating system is deployed on the device to be processed through the central node server that is closest to the device to be processed.

具体而言,中心节点服务器部署完成后,每个中心节点服务器都配置为一个微型部署中心,可以独立地为其他新节点提供Linux操作系统的Docker镜像。每个节点都配置服务发现机制,如etcd或Consul,以便于部署节点能够自动发现彼此。Specifically, after the central node server is deployed, each central node server is configured as a micro deployment center that can independently provide Docker images of the Linux operating system to other new nodes. Each node is configured with a service discovery mechanism, such as etcd or Consul, so that the deployed nodes can automatically discover each other.

以下为配置服务发现的示例代码:The following is a sample code for configuring service discovery:

1.安装服务发现工具1. Install the service discovery tool

2.在所有部署节点上安装etcd或Consul。以Consul为例,可以通过包管理器或直接从官方网站下载安装。2. Install etcd or Consul on all deployment nodes. Taking Consul as an example, you can download and install it through the package manager or directly from the official website.

3.3.

4.#使用apt-get安装Consul(适用于Debian/Ubuntu系统)4.#Install Consul using apt-get (for Debian/Ubuntu systems)

5.sudo apt-get update5.sudo apt-get update

6.sudo apt-get install consul6.sudo apt-get install consul

7.7.

8.#或者使用yum安装Consul(适用于CentOS/RHEL系统)8.#Or use yum to install Consul (applicable to CentOS/RHEL system)

9.sudo yuminstall consul9.sudo yuminstall consul

10.配置服务发现工具10. Configure service discovery tools

11.配置etcd或Consul,通常涉及设置一个或多个服务器节点作为集群,以及配置客户端节点。11.Configure etcd or Consul, which usually involves setting up one or more server nodes as a cluster, and configuring client nodes.

12.12.

13.服务器节点配置:13. Server node configuration:

14.在服务器节点上,配置etcd或Consul以启动服务并加入集群。例如,对于Consul,可以使用以下命令启动代理并加入集群:14. On the server node, configure etcd or Consul to start the service and join the cluster. For example, for Consul, you can use the following command to start the agent and join the cluster:

15.consul agent-server-bootstrap-expect=3-data-dir="/tmp/consul"-node=server-1-bind=127.0.0.115.consul agent-server-bootstrap-expect=3-data-dir="/tmp/consul"-node=server-1-bind=127.0.0.1

16.客户端节点配置:16. Client node configuration:

17.在客户端节点上,配置etcd或Consul以加入集群并使用服务。例如,对于Consul,可以使用以下命令启动客户端代理:17. On the client node, configure etcd or Consul to join the cluster and use the service. For example, for Consul, you can start the client agent with the following command:

18.consul agent-client 0.0.0.0-data-dir="/tmp/consul"-node=client-1-bind=127.0.0.118.consul agent-client 0.0.0.0-data-dir="/tmp/consul"-node=client-1-bind=127.0.0.1

19.注册服务19. Registration Services

20.部署节点需要在服务发现工具中注册自己的服务。这通常通过API或配置文件完成。20. Deployed nodes need to register their services in the service discovery tool. This is usually done through an API or configuration file.

21.twenty one.

22.API注册:22.API Registration:

23.使用etcd或Consul提供的API注册服务。例如,使用Consul的HTTP API注册一个名为my-service的服务:23. Use the API provided by etcd or Consul to register the service. For example, use Consul's HTTP API to register a service named my-service:

24.curl-X PUT--data'{"service":{"name":"my-service","tags":["tag1","tag2"],"address":"10.1.2.3","port":8080}}'http://127.0.0.1:8500/v1/agent/service/register24.curl-X PUT--data'{"service":{"name":"my-service","tags":["tag1","tag2"],"address":"10.1.2.3", "port":8080}}'http://127.0.0.1:8500/v1/agent/service/register

25.配置文件注册:25. Profile Registration:

26.在Consul的配置文件中定义服务,并启动Consul以自动注册服务。26. Define the service in the Consul configuration file and start Consul to automatically register the service.

27.发现服务27. Discovery Service

28.部署节点可以通过服务发现工具查询其他服务的位置和状态。28. Deployment nodes can query the location and status of other services through service discovery tools.

29.29.

30.健康检查:30. Health Check:

31.31.

32.服务发现工具可以对注册的服务进行健康检查,确保只有健康的服务实例被返回给请求者。32. Service discovery tools can perform health checks on registered services to ensure that only healthy service instances are returned to requesters.

33.服务查询:33. Service Inquiry:

34.34.

35.部署节点可以通过服务名称查询可用的服务实例。例如,使用Consul的DNS或HTTP API查询my-service:35. Deployment nodes can query available service instances by service name. For example, use Consul's DNS or HTTP API to query my-service:

36.dig@127.0.0.1-p 8600my-service.node.consul36.dig@127.0.0.1-p 8600my-service.node.consul

37.37.

38.#或者使用HTTP API38.#Or use HTTP API

39.curl http://127.0.0.1:8500/v1/health/service/my-service39.curl http://127.0.0.1:8500/v1/health/service/my-service

具体而言,针对各个待处理设备,确定距离待处理设备最近的中心节点服务器,通过距离待处理设备最近的中心节点服务器,对待处理设备部署服务器操作系统,待处理设备节点能够通过服务发现自动连接到最近的部署中心节点。Specifically, for each device to be processed, determine the central node server closest to the device to be processed, and deploy the server operating system to the device to be processed through the central node server closest to the device to be processed. The device node to be processed can automatically connect to the nearest deployment central node through service discovery.

为各个待处理设备分配中心节点服务器,使用DHCP服务器与负载均衡器结合的方式。DHCP服务器负责分配IP地址,同时提供PXE启动文件的位置信息。通过负载均衡减少了单个节点的性能压力,提高了整体部署性能。Assign a central node server to each device to be processed, using a combination of a DHCP server and a load balancer. The DHCP server is responsible for allocating IP addresses and providing the location information of the PXE boot file. Load balancing reduces the performance pressure of a single node and improves the overall deployment performance.

如下为示例代码:The following is the sample code:

1.配置DHCP服务器:在DHCP服务器的配置中,指定负载均衡器的IP地址作为PXE启动服务器的地址。1. Configure the DHCP server: In the DHCP server configuration, specify the IP address of the load balancer as the address of the PXE boot server.

2.DHCP服务器配置示例:2.DHCP server configuration example:

3.next-server 10.0.0.100;#负载均衡器的IP地址3.next-server 10.0.0.100; #IP address of the load balancer

4.filename"/pxelinux.0";#PXE启动文件4.filename "/pxelinux.0"; #PXE boot file

通过服务发现机制,部署节点能够自动发现彼此,这种基于P2P(对等节点)机制的自扩展部署,避免了使用单台预启动执行环境服务器提供网络启动服务和操作系统镜像进行服务器集群部署,在网络中断或不稳定时导致的部署失败,从而提高了服务器集群部署的稳定性和效率。Through the service discovery mechanism, deployment nodes can automatically discover each other. This self-expanding deployment based on the P2P (peer-to-peer) mechanism avoids the use of a single pre-boot execution environment server to provide network boot services and operating system images for server cluster deployment, which may cause deployment failures when the network is interrupted or unstable, thereby improving the stability and efficiency of server cluster deployment.

在本发明实施例中,所述通过所述距离所述待处理设备最近的中心节点服务器,对所述待处理设备部署服务器操作系统,包括:In the embodiment of the present invention, the deploying a server operating system on the device to be processed through the central node server closest to the device to be processed includes:

从所述距离所述待处理设备最近的中心节点服务器中获取容器镜像,并存储至所述待处理设备;Obtaining a container image from the central node server closest to the device to be processed, and storing it in the device to be processed;

启动所述待处理设备中的容器镜像,对所述待处理设备部署服务器操作系统。Start the container image in the device to be processed, and deploy a server operating system on the device to be processed.

具体而言,待处理设备连接到最近的中心节点服务器后,中心节点服务器作为PXE服务器对待处理设备进行部署,从距离待处理设备最近的中心节点服务器中获取容器镜像,并将容器镜像存储至待处理设备,然后启动所述待处理设备中的容器镜像,对待处理设备部署服务器操作系统。Specifically, after the device to be processed is connected to the nearest central node server, the central node server deploys the device to be processed as a PXE server, obtains the container image from the central node server closest to the device to be processed, and stores the container image to the device to be processed, and then starts the container image in the device to be processed to deploy the server operating system to the device to be processed.

通过从中心节点服务器中获取容器镜像,能够避免使用单台预启动执行环境服务器提供操作系统镜像进行服务器集群部署,在网络中断或不稳定时导致的部署失败,从而提高了服务器集群部署的稳定性和效率。By obtaining the container image from the central node server, it is possible to avoid using a single pre-start execution environment server to provide the operating system image for server cluster deployment, which may cause deployment failures when the network is interrupted or unstable, thereby improving the stability and efficiency of server cluster deployment.

在本发明实施例中,所述启动所述待处理设备中的容器镜像包括:In an embodiment of the present invention, starting the container image in the device to be processed includes:

获取启动所述待处理设备中的容器镜像的预设启动脚本;Obtaining a preset startup script for starting the container image in the device to be processed;

运行所述预设启动脚本,启动所述待处理设备中的容器镜像。Run the preset startup script to start the container image in the device to be processed.

具体而言,从从距离待处理设备最近的中心节点服务器中获取预设启动脚本,预设启动脚本也就是部署脚本,通过运行预设启动脚本,启动待处理设备中的容器镜像。通过从中心节点服务器中获取启动脚本,避免了使用单台预启动执行环境服务器提供网络启动服务,在网络中断或不稳定时导致的部署失败,从而提高了服务器集群部署的稳定性和效率。Specifically, the preset startup script is obtained from the central node server closest to the device to be processed. The preset startup script is also the deployment script. By running the preset startup script, the container image in the device to be processed is started. By obtaining the startup script from the central node server, the deployment failure caused by network interruption or instability caused by using a single pre-start execution environment server to provide network startup services is avoided, thereby improving the stability and efficiency of server cluster deployment.

在另一种实现方式中,通过中心节点服务器对待处理的设备待处理设备部署服务器操作系统,还包括:在中心节点服务器部署预设数量的待处理设备后,确定所述预设数量的待处理设备为新增中心节点服务器,通过中心节点服务器与新增中心节点服务器对待处理的设备待处理设备部署服务器操作系统。通过这种方式,增加中心节点服务器的数量,能够提高部署效率。In another implementation, deploying a server operating system on the devices to be processed by the central node server also includes: after the central node server deploys a preset number of devices to be processed, determining that the preset number of devices to be processed are newly added central node servers, and deploying a server operating system on the devices to be processed by the central node server and the newly added central node server. In this way, increasing the number of central node servers can improve deployment efficiency.

本发明实施例非中心化的部署方法,与依赖中心服务器的传统PXE部署方法不同,本发明采用非中心化的P2P机制,通过节点间的自动发现和通信,实现软件栈的部署。基于权重的节点选择,通过收集节点的属性(如CPU性能、内存大小等),并根据这些属性为节点分配权重,来选择最适合的节点进行部署,这种方法提高了部署的效率和可靠性。Docker容器化技术的应用:通过使用Docker容器化技术,本发明能够创建轻量级的Linux安装器,简化了部署流程,并且使得部署的系统更加灵活和可移植。服务发现与负载均衡:结合服务发现工具(如etcd或Consul)和容器编排工具(如Docker Swarm或Kubernetes),本发明实现了服务的自动注册、健康检查、负载均衡,进一步提升了系统的稳定性和扩展性。The decentralized deployment method of the embodiment of the present invention is different from the traditional PXE deployment method that relies on a central server. The present invention adopts a decentralized P2P mechanism to realize the deployment of the software stack through automatic discovery and communication between nodes. Weight-based node selection collects node attributes (such as CPU performance, memory size, etc.) and assigns weights to nodes according to these attributes to select the most suitable node for deployment. This method improves the efficiency and reliability of deployment. Application of Docker containerization technology: By using Docker containerization technology, the present invention can create a lightweight Linux installer, simplify the deployment process, and make the deployed system more flexible and portable. Service discovery and load balancing: Combining service discovery tools (such as etcd or Consul) and container orchestration tools (such as Docker Swarm or Kubernetes), the present invention realizes automatic registration, health check, and load balancing of services, further improving the stability and scalability of the system.

需要说明的是,对于方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明实施例并不受所描述的动作顺序的限制,因为依据本发明实施例,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作并不一定是本发明实施例所必须的。It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the described action sequence, because according to the embodiments of the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

参照图2,示出了本发明实施例的一种部署服务器集群的装置的结构框图,所述装置具体可以包括如下模块:2, a structural block diagram of a device for deploying a server cluster according to an embodiment of the present invention is shown. The device may specifically include the following modules:

中心节点服务器部署模块201,用于通过预设的预启动执行环境服务器,对预设数量的设备部署服务器操作系统,并将部署所述服务器操作系统的设备作为中心节点服务器;The central node server deployment module 201 is used to deploy the server operating system to a preset number of devices through a preset pre-start execution environment server, and use the devices where the server operating system is deployed as central node servers;

设备信息获取模块202,用于获取所述中心节点服务器的设备信息;The device information acquisition module 202 is used to acquire the device information of the central node server;

确定模块203,用于根据所述中心节点服务器的设备信息,确定所述中心节点服务器对待处理设备部署服务器操作系统时,允许同时部署的设备数量;A determination module 203 is used to determine, according to the device information of the central node server, the number of devices that the central node server is allowed to deploy simultaneously when deploying a server operating system on the device to be processed;

待处理设备部署模块204,用于根据所述中心节点服务器允许同时部署的设备数量,对所述对待处理设备部署服务器操作系统。The to-be-processed device deployment module 204 is used to deploy a server operating system to the to-be-processed device according to the number of devices that the central node server allows to be deployed simultaneously.

本发明实施例的装置,通过预设的预启动执行环境服务器,对预设数量的设备部署服务器操作系统,并将部署所述服务器操作系统的设备作为中心节点服务器,然后获取中心节点服务器的设备信息,根据中心节点服务器的设备信息,确定中心节点服务器对待处理设备部署服务器操作系统时,允许同时部署的设备数量,再根据中心节点服务器允许同时部署的设备数量,对待处理设备部署服务器操作系统。在部署预设数量的中心节点服务器之后,通过预设数量的中心节点服务器对待处理设备部署服务器操作系统,从而避免了使用单台预启动执行环境服务器提供网络启动服务和操作系统镜像进行服务器集群部署,在网络中断或不稳定时导致的部署失败,从而提高了服务器集群部署的稳定性和效率。The device of the embodiment of the present invention deploys the server operating system to a preset number of devices through a preset pre-start execution environment server, and uses the device on which the server operating system is deployed as a central node server, then obtains the device information of the central node server, determines the number of devices that the central node server allows to be deployed simultaneously when deploying the server operating system to the device to be processed according to the device information of the central node server, and then deploys the server operating system to the device to be processed according to the number of devices that the central node server allows to be deployed simultaneously. After deploying a preset number of central node servers, the server operating system is deployed to the device to be processed through the preset number of central node servers, thereby avoiding the use of a single pre-start execution environment server to provide network startup services and operating system images for server cluster deployment, which causes deployment failures when the network is interrupted or unstable, thereby improving the stability and efficiency of server cluster deployment.

在本发明实施例中,所述预设的预启动执行环境服务器包括容器镜像,所述容器镜像包括所述服务器操作系统镜像;所述中心节点服务器部署模块,包括:In an embodiment of the present invention, the preset pre-start execution environment server includes a container image, and the container image includes the server operating system image; the central node server deployment module includes:

发送子模块,用于将所述预设的预启动执行环境服务器的所述容器镜像分别发送至所述预设数量的设备;A sending submodule, used for sending the container image of the preset pre-start execution environment server to the preset number of devices respectively;

启动子模块,用于启动所述预设数量的设备中的容器镜像,对预设数量的设备部署服务器操作系统。The startup submodule is used to start the container images in the preset number of devices and deploy the server operating system to the preset number of devices.

在本发明实施例中,所述中心节点服务器的所述设备信息包括中央处理器性能、内存大小、存储速度、当前负载或网络带宽至少一种;所述确定模块,包括:In an embodiment of the present invention, the device information of the central node server includes at least one of central processing unit performance, memory size, storage speed, current load or network bandwidth; the determination module includes:

确定子模块,用于根据所述中心节点服务器的中央处理器性能、内存大小、存储速度、当前负载或网络带宽至少一种,确定所述中心节点服务器对待处理设备部署服务器操作系统时,允许同时部署的设备数量。The determination submodule is used to determine the number of devices allowed to be deployed simultaneously when the central node server deploys a server operating system on the processed device based on at least one of the central processing unit performance, memory size, storage speed, current load or network bandwidth of the central node server.

在本发明实施例中,所述待处理设备部署模块,包括:In an embodiment of the present invention, the to-be-processed device deployment module includes:

总数量确定子模块,用于确定所有的所述中心节点服务器允许同时部署的设备数量的总数量;A total number determination submodule, used to determine the total number of devices that all the central node servers are allowed to deploy simultaneously;

比较子模块,用于比较所述待处理设备的数量与所述总数量;A comparison submodule, used for comparing the number of the devices to be processed with the total number;

第一比较结果子模块,用于在所述待处理设备的数量等于所述总数量时,通过所有的所述中心节点服务器,对所述待处理设备部署服务器操作系统;A first comparison result submodule is used to deploy a server operating system to the devices to be processed through all the central node servers when the number of the devices to be processed is equal to the total number;

第二比较结果子模块,用于在所述待处理设备的数量小于所述总数量时,根据各个所述中心节点服务器允许同时部署的设备数量,确定目标中心节点服务器,通过所述目标中心节点服务器对所述待处理设备部署服务器操作系统;A second comparison result submodule is used to determine a target central node server according to the number of devices that each central node server allows to be deployed simultaneously when the number of the devices to be processed is less than the total number, and deploy a server operating system to the devices to be processed through the target central node server;

第三比较结果子模块,用于在所述待处理设备的数量大于所述总数量时,根据每个所述中心节点服务器允许同时部署的设备数量,使每个所述中心节点服务器同时对对应数量的待处理设备部署服务器操作系统;以及每当所述中心节点服务器完成对待处理设备部署服务器操作系统的操作后,从剩余的待处理设备确定所述中心节点服务器所需处理的待处理设备并对所述所需处理的待处理设备部署服务器操作系统。The third comparison result submodule is used to, when the number of the devices to be processed is greater than the total number, enable each of the central node servers to simultaneously deploy the server operating system to a corresponding number of devices to be processed according to the number of devices that each of the central node servers is allowed to deploy simultaneously; and whenever the central node server completes the operation of deploying the server operating system to the devices to be processed, determine the devices to be processed that the central node server needs to process from the remaining devices to be processed and deploy the server operating system to the devices to be processed.

在本发明实施例中,所述中心节点服务器和所述待处理设备配置有服务发现,所述第一比较结果子模块,包括:In the embodiment of the present invention, the central node server and the device to be processed are configured with service discovery, and the first comparison result submodule includes:

距离确定单元,用于针对各个所述待处理设备,确定距离所述待处理设备最近的中心节点服务器;A distance determination unit, used for determining, for each of the devices to be processed, a central node server closest to the device to be processed;

部署单元,用于通过所述距离所述待处理设备最近的中心节点服务器,对所述待处理设备部署服务器操作系统。The deployment unit is used to deploy a server operating system to the device to be processed through the central node server closest to the device to be processed.

在本发明实施例中,所述部署单元,包括:In an embodiment of the present invention, the deployment unit includes:

容器镜像获取子单元,用于从所述距离所述待处理设备最近的中心节点服务器中获取容器镜像,并存储至所述待处理设备;A container image acquisition subunit, configured to acquire a container image from a central node server closest to the device to be processed, and store the container image in the device to be processed;

启动子单元,用于启动所述待处理设备中的容器镜像,对所述待处理设备部署服务器操作系统。The startup subunit is used to start the container image in the device to be processed and deploy a server operating system to the device to be processed.

在本发明实施例中,所述启动子单元,具体用于:In an embodiment of the present invention, the promoter unit is specifically used for:

获取启动所述待处理设备中的容器镜像的预设启动脚本;Obtaining a preset startup script for starting the container image in the device to be processed;

运行所述预设启动脚本,启动所述待处理设备中的容器镜像。Run the preset startup script to start the container image in the device to be processed.

对于装置实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

参照图3,示出了本发明实施例的一种电子设备,包括:3, an electronic device according to an embodiment of the present invention is shown, comprising:

包括处理器、存储器及存储在所述存储器上并能够在所述处理器上运行的计算机程序,该计算机程序被处理器执行时实现上述模型训练方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned model training method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

参照图4,示出了本发明实施例的一种计算机可读存储介质,计算机可读存储介质上存储计算机程序,计算机程序被处理器执行时实现上述模型训练方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。Referring to Figure 4, a computer-readable storage medium of an embodiment of the present invention is shown. A computer program is stored on the computer-readable storage medium. When the computer program is executed by the processor, the various processes of the above-mentioned model training method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

本领域内的技术人员应明白,本发明实施例的实施例可提供为方法、装置、或计算机程序产品。因此,本发明实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that the embodiments of the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

本发明实施例是参照根据本发明实施例的方法、终端设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理终端设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理终端设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The embodiments of the present invention are described with reference to the flowcharts and/or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and/or box in the flowchart and/or block diagram, as well as the combination of the processes and/or boxes in the flowchart and/or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate a device for implementing the functions specified in one process or multiple processes in the flowchart and/or one box or multiple boxes in the block diagram.

这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理终端设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.

这些计算机程序指令也可装载到计算机或其他可编程数据处理终端设备上,使得在计算机或其他可编程终端设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程终端设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce computer-implemented processing, so that the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.

尽管已描述了本发明实施例的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明实施例范围的所有变更和修改。Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者终端设备中还存在另外的相同要素。Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

以上对本发明所提供的一种部署服务器集群的方法、装置、电子设备和存储介质,进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The above is a detailed introduction to a method, device, electronic device and storage medium for deploying a server cluster provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims (10)

1. A method of deploying a server cluster, the method comprising:
A server operating system is deployed for a preset number of devices through a preset pre-starting execution environment server, and the devices for deploying the server operating system are used as a central node server;
acquiring equipment information of the central node server;
According to the equipment information of the central node server, determining the quantity of equipment which is allowed to be deployed simultaneously when the central node server deploys a server operating system for equipment to be processed;
and deploying a server operating system for the equipment to be processed according to the number of the equipment which is allowed to be deployed simultaneously by the central node server.
2. The method of claim 1, the pre-set pre-boot execution environment server comprising a container image, the container image comprising the server operating system image; the deploying a server operating system for a preset number of devices through a preset pre-start execution environment server comprises:
the container images of the preset pre-starting execution environment server are respectively sent to the preset number of devices;
And starting the container mirror images in the preset number of devices, and deploying a server operating system for the preset number of devices.
3. The method of claim 1, wherein the device information of the central node server includes at least one of central processor performance, memory size, storage speed, current load, or network bandwidth; the determining, according to the device information of the central node server, the number of devices allowed to be deployed simultaneously when the central node server deploys a server operating system for the devices to be processed, includes:
and determining the number of devices which are allowed to be deployed simultaneously when the central node server deploys a server operating system for the devices to be processed according to at least one of the central processor performance, the memory size, the storage speed, the current load or the network bandwidth of the central node server.
4. The method of claim 1, wherein the deploying a server operating system for the device to be processed according to the number of devices that the central node server allows to be deployed simultaneously, comprises:
Determining a total number of the number of devices that all of the central node servers allow to be deployed simultaneously;
Comparing the number of devices to be treated with the total number;
when the number of the to-be-processed devices is equal to the total number, deploying a server operating system for the to-be-processed devices through all the center node servers;
When the number of the to-be-processed devices is smaller than the total number, determining a target center node server according to the number of the devices which are allowed to be deployed simultaneously by the center node servers, and deploying a server operating system for the to-be-processed devices through the target center node server;
When the number of the to-be-processed devices is larger than the total number, according to the number of the devices which are allowed to be deployed simultaneously by each central node server, enabling each central node server to deploy a server operating system for the corresponding number of to-be-processed devices simultaneously; and determining the equipment to be processed required by the central node server from the rest equipment to be processed and deploying the server operating system for the equipment to be processed after the central node server finishes the operation of deploying the server operating system for the equipment to be processed.
5. The method of claim 4, wherein the central node server and the pending devices are configured with service discovery, wherein deploying a server operating system to the pending devices through all of the central node servers comprises:
Determining a center node server nearest to each device to be processed;
And deploying a server operating system for the equipment to be processed through the center node server closest to the equipment to be processed.
6. The method of claim 5, wherein deploying a server operating system to the device to be processed through the closest central node server to the device to be processed comprises:
Obtaining a container mirror image from the center node server closest to the equipment to be processed, and storing the container mirror image to the equipment to be processed;
And starting the container mirror image in the equipment to be processed, and deploying a server operating system for the equipment to be processed.
7. The method of claim 6, wherein said enabling the mirroring of the container in the device to be processed comprises:
acquiring a preset starting script for starting the container mirror image in the equipment to be processed;
And running the preset starting script to start the container mirror image in the equipment to be processed.
8. An apparatus for deploying a server cluster, the apparatus comprising:
the central node server deployment module is used for deploying server operating systems for a preset number of devices through a preset pre-starting execution environment server, and taking the devices deploying the server operating systems as a central node server;
the equipment information acquisition module is used for acquiring the equipment information of the central node server;
the determining module is used for determining the number of the equipment which is allowed to be deployed simultaneously when the central node server deploys a server operating system for the equipment to be processed according to the equipment information of the central node server;
The device to be processed deployment module is used for deploying a server operating system for the device to be processed according to the number of the devices which are allowed to be deployed simultaneously by the central node server.
9. An electronic device, comprising: a processor, a memory and a computer program stored on the memory and capable of running on the processor, which when executed by the processor performs the steps of the method of deploying server clusters according to any one of claims 1-7.
10. A computer readable storage medium, characterized in that it has stored thereon a computer program which, when executed by a processor, implements the steps of the method for deploying server clusters according to any one of claims 1 to 7.
CN202410831465.5A 2024-06-25 2024-06-25 Method, device, electronic device and storage medium for deploying server cluster Pending CN118740616A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410831465.5A CN118740616A (en) 2024-06-25 2024-06-25 Method, device, electronic device and storage medium for deploying server cluster

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410831465.5A CN118740616A (en) 2024-06-25 2024-06-25 Method, device, electronic device and storage medium for deploying server cluster

Publications (1)

Publication Number Publication Date
CN118740616A true CN118740616A (en) 2024-10-01

Family

ID=92854503

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410831465.5A Pending CN118740616A (en) 2024-06-25 2024-06-25 Method, device, electronic device and storage medium for deploying server cluster

Country Status (1)

Country Link
CN (1) CN118740616A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101820387A (en) * 2010-02-08 2010-09-01 北京航空航天大学 Method for rapidly deploying extensible cluster
US20120042195A1 (en) * 2010-08-10 2012-02-16 International Business Machines Corporation Managing operating system deployment failure
US20160188425A1 (en) * 2014-12-31 2016-06-30 Oracle International Corporation Deploying services on application server cloud with high availability
CN108052332A (en) * 2017-12-04 2018-05-18 郑州云海信息技术有限公司 A kind of method of batch installation node operating system
CN110489134A (en) * 2019-07-26 2019-11-22 苏州浪潮智能科技有限公司 A kind of dispositions method and system of PXE server and High-Performance Computing Cluster environment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101820387A (en) * 2010-02-08 2010-09-01 北京航空航天大学 Method for rapidly deploying extensible cluster
US20120042195A1 (en) * 2010-08-10 2012-02-16 International Business Machines Corporation Managing operating system deployment failure
US20160188425A1 (en) * 2014-12-31 2016-06-30 Oracle International Corporation Deploying services on application server cloud with high availability
CN108052332A (en) * 2017-12-04 2018-05-18 郑州云海信息技术有限公司 A kind of method of batch installation node operating system
CN110489134A (en) * 2019-07-26 2019-11-22 苏州浪潮智能科技有限公司 A kind of dispositions method and system of PXE server and High-Performance Computing Cluster environment

Similar Documents

Publication Publication Date Title
US20220004395A1 (en) Securely and reliably transferring startup script
US8892700B2 (en) Collecting and altering firmware configurations of target machines in a software provisioning environment
US7600005B2 (en) Method and apparatus for provisioning heterogeneous operating systems onto heterogeneous hardware systems
US8782204B2 (en) Monitoring hardware resources in a software provisioning environment
US8402123B2 (en) Systems and methods for inventorying un-provisioned systems in a software provisioning environment
US8775578B2 (en) Providing hardware updates in a software environment
US9250672B2 (en) Cloning target machines in a software provisioning environment
US9727320B2 (en) Configuration of provisioning servers in virtualized systems
US9021470B2 (en) Software provisioning in multiple network configuration environment
US7802084B2 (en) System and method for management and installation of operating system images for computers
US9124497B2 (en) Supporting multiple name servers in a software provisioning environment
US8832256B2 (en) Providing a rescue Environment in a software provisioning environment
US20100217944A1 (en) Systems and methods for managing configurations of storage devices in a software provisioning environment
JP7748791B2 (en) Agentless installation for building deployments
US7363514B1 (en) Storage area network(SAN) booting method
US11349721B2 (en) Discovering switch port locations and internet protocol addresses of compute nodes
US12197939B2 (en) Provisioning DPU management operating systems
JP2023062135A (en) System and method for retrieving data from data generation apparatus non-networked and remotely located
US12175257B2 (en) Provisioning DPU management operating systems using host and DPU boot coordination
CN118740616A (en) Method, device, electronic device and storage medium for deploying server cluster
KR102414260B1 (en) Method and apparatus for automatically installing operating system in an environment of network
US11516079B1 (en) Network initialization communication storage system
WO2023141069A1 (en) Provisioning dpu management operating systems
Dell RackHD Documentation
Cloud Intel® Cloud Builders Guide: Cloud Design and Deployment on Intel Platforms

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