教學課程:在 Amazon EC2 上設定 Windows HPC 叢集
您可以使用 Amazon EC2 執行個體啟動可擴展性 Windows 高效能運算 (HPC) 叢集。Windows HPC 叢集需要 Active Directory 網域控制站、DNS 伺服器、前端節點及一或多個運算節點。
若要在 Amazon EC2 上設定 Windows HPC 叢集,請完成下列任務:
如需高效能運算的詳細資訊,請參閱 AWS 上的高效能運算 (HPC)
先決條件
您必須在 VPC 中啟動您的執行個體。您可以使用預設 VPC 或建立非預設 VPC。如需詳細資訊,請參閱Amazon VPC 使用者指南中的入門。
步驟 1:建立安全群組
使用 Tools for Windows PowerShell 建立網域控制站、網域成員和 HPC 叢集的安全群組。
建立安全群組
-
使用 New-EC2SecurityGroup Cmdlet 建立網域控制站的安全群組。記下輸出中安全群組的 ID。
PS C:\>
New-EC2SecurityGroup -VpcIdvpc-id
-GroupName "SG - Domain Controller" -Description "Active Directory Domain Controller" -
使用 New-EC2SecurityGroup Cmdlet 建立網域成員的安全群組。記下輸出中安全群組的 ID。
PS C:\>
New-EC2SecurityGroup -VpcIdvpc-id
-GroupName "SG - Domain Member" -Description "Active Directory Domain Member" -
使用 New-EC2SecurityGroup Cmdlet 建立 HPC 叢集的安全群組。記下輸出中安全群組的 ID。
PS C:\>
New-EC2SecurityGroup -VpcIdvpc-id
-GroupName "SG - Windows HPC Cluster" -Description "Windows HPC Cluster Nodes"
新增規則至安全群組
-
建立下列規則以新增至網域控制站安全群組。使用網域成員安全群組的 ID 取代預留位置的安全群組 ID,並使用您網路的 CIDR 區塊取代預留位置的 CIDR 區塊。
PS C:\>
$sg_dm = New-Object Amazon.EC2.Model.UserIdGroupPairPS C:\>
$sg_dm.GroupId = "sg-12345678
PS C:\>
$r1 = @{ IpProtocol="UDP"; FromPort="123"; ToPort="123"; UserIdGroupPairs=$sg_dm }PS C:\>
$r2 = @{ IpProtocol="TCP"; FromPort="135"; ToPort="135"; UserIdGroupPairs=$sg_dm }PS C:\>
$r3 = @{ IpProtocol="UDP"; FromPort="138"; ToPort="138"; UserIdGroupPairs=$sg_dm }PS C:\>
$r4 = @{ IpProtocol="TCP"; FromPort="49152"; ToPort="65535"; UserIdGroupPairs=$sg_dm }PS C:\>
$r5 = @{ IpProtocol="TCP"; FromPort="389"; ToPort="389"; UserIdGroupPairs=$sg_dm }PS C:\>
$r6 = @{ IpProtocol="UDP"; FromPort="389"; ToPort="389"; UserIdGroupPairs=$sg_dm }PS C:\>
$r7 = @{ IpProtocol="TCP"; FromPort="636"; ToPort="636"; UserIdGroupPairs=$sg_dm }PS C:\>
$r8 = @{ IpProtocol="TCP"; FromPort="3268"; ToPort="3269"; UserIdGroupPairs=$sg_dm }PS C:\>
$r9 = @{ IpProtocol="TCP"; FromPort="53"; ToPort="53"; UserIdGroupPairs=$sg_dm }PS C:\>
$r10 = @{ IpProtocol="UDP"; FromPort="53"; ToPort="53"; UserIdGroupPairs=$sg_dm }PS C:\>
$r11 = @{ IpProtocol="TCP"; FromPort="88"; ToPort="88"; UserIdGroupPairs=$sg_dm }PS C:\>
$r12 = @{ IpProtocol="UDP"; FromPort="88"; ToPort="88"; UserIdGroupPairs=$sg_dm }PS C:\>
$r13 = @{ IpProtocol="TCP"; FromPort="445"; ToPort="445"; UserIdGroupPairs=$sg_dm }PS C:\>
$r14 = @{ IpProtocol="UDP"; FromPort="445"; ToPort="445"; UserIdGroupPairs=$sg_dm }PS C:\>
$r15 = @{ IpProtocol="ICMP"; FromPort="-1"; ToPort="-1"; UserIdGroupPairs=$sg_dm }PS C:\>
$r16 = @{ IpProtocol="UDP"; FromPort="53"; ToPort="53"; IpRanges="203.0.113.25/32
" }PS C:\>
$r17 = @{ IpProtocol="TCP"; FromPort="3389"; ToPort="3389"; IpRanges="203.0.113.25/32
" } -
使用 Grant-EC2SecurityGroupIngress Cmdlet 將規則新增至網域控制站安全群組。
PS C:\>
Grant-EC2SecurityGroupIngress -GroupId sg-1a2b3c4d
-IpPermission @( $r1, $r2, $r3, $r4, $r5, $r6, $r7, $r8, $r9, $r10, $r11, $r12, $r13, $r14, $r15, $r16, $r17 )如需這些安全群組規則的詳細資訊,請參閱下列 Microsoft 文章:How to configure a firewall for domains and trusts
。 -
建立下列規則以新增至網域成員安全群組。使用網域控制站安全群組 ID 取代預留位置的安全群組 ID。
PS C:\>
$sg_dc = New-Object Amazon.EC2.Model.UserIdGroupPairPS C:\>
$sg_dc.GroupId = "sg-1a2b3c4d
PS C:\>
$r1 = @{ IpProtocol="TCP"; FromPort="49152"; ToPort="65535"; UserIdGroupPairs=$sg_dc }PS C:\>
$r2 = @{ IpProtocol="UDP"; FromPort="49152"; ToPort="65535"; UserIdGroupPairs=$sg_dc }PS C:\>
$r3 = @{ IpProtocol="TCP"; FromPort="53"; ToPort="53"; UserIdGroupPairs=$sg_dc }PS C:\>
$r4 = @{ IpProtocol="UDP"; FromPort="53"; ToPort="53"; UserIdGroupPairs=$sg_dc } -
使用 Grant-EC2SecurityGroupIngress Cmdlet 將規則新增至網域成員安全群組。
PS C:\>
Grant-EC2SecurityGroupIngress -GroupId sg-12345678
-IpPermission @( $r1, $r2, $r3, $r4 ) -
建立下列規則以新增至 HPC 叢集安全群組。使用 HPC 叢集安全群組的 ID 取代預留位置的安全群組 ID,並使用您網路的 CIDR 區塊取代預留位置的 CIDR 區塊。
$sg_hpc = New-Object Amazon.EC2.Model.UserIdGroupPair
PS C:\>
$sg_hpc.GroupId = "sg-87654321
PS C:\>
$r1 = @{ IpProtocol="TCP"; FromPort="80"; ToPort="80"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r2 = @{ IpProtocol="TCP"; FromPort="443"; ToPort="443"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r3 = @{ IpProtocol="TCP"; FromPort="1856"; ToPort="1856"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r4 = @{ IpProtocol="TCP"; FromPort="5800"; ToPort="5800"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r5 = @{ IpProtocol="TCP"; FromPort="5801"; ToPort="5801"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r6 = @{ IpProtocol="TCP"; FromPort="5969"; ToPort="5969"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r7 = @{ IpProtocol="TCP"; FromPort="5970"; ToPort="5970"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r8 = @{ IpProtocol="TCP"; FromPort="5974"; ToPort="5974"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r9 = @{ IpProtocol="TCP"; FromPort="5999"; ToPort="5999"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r10 = @{ IpProtocol="TCP"; FromPort="6729"; ToPort="6730"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r11 = @{ IpProtocol="TCP"; FromPort="7997"; ToPort="7997"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r12 = @{ IpProtocol="TCP"; FromPort="8677"; ToPort="8677"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r13 = @{ IpProtocol="TCP"; FromPort="9087"; ToPort="9087"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r14 = @{ IpProtocol="TCP"; FromPort="9090"; ToPort="9092"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r15 = @{ IpProtocol="TCP"; FromPort="9100"; ToPort="9163"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r16 = @{ IpProtocol="TCP"; FromPort="9200"; ToPort="9263"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r17 = @{ IpProtocol="TCP"; FromPort="9794"; ToPort="9794"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r18 = @{ IpProtocol="TCP"; FromPort="9892"; ToPort="9893"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r19 = @{ IpProtocol="UDP"; FromPort="9893"; ToPort="9893"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r20 = @{ IpProtocol="TCP"; FromPort="6498"; ToPort="6498"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r21 = @{ IpProtocol="TCP"; FromPort="7998"; ToPort="7998"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r22 = @{ IpProtocol="TCP"; FromPort="8050"; ToPort="8050"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r23 = @{ IpProtocol="TCP"; FromPort="5051"; ToPort="5051"; UserIdGroupPairs=$sg_hpc }PS C:\>
$r24 = @{ IpProtocol="TCP"; FromPort="3389"; ToPort="3389"; IpRanges="203.0.113.25/32
" } -
使用 Grant-EC2SecurityGroupIngress Cmdlet 將規則新增至 HPC 叢集安全群組。
PS C:\>
Grant-EC2SecurityGroupIngress -GroupId sg-87654321
-IpPermission @( $r1, $r2, $r3, $r4, $r5, $r6, $r7, $r8, $r9, $r10, $r11, $r12, $r13, $r14, $r15, $r16, $r17, $r18, $r19, $r20, $r21, $r22, $r23, $r24 )如需這些安全群組規則的詳細資訊,請參閱下列 Microsoft 文章:HPC Cluster Networking: Windows Firewall configuration
。 在 https://console.aws.amazon.com/ec2/
開啟 Amazon EC2 主控台。 -
在導覽窗格中,選擇 Security Groups (安全群組)。確認三個安全群組皆出現在清單中,並且皆具有必要的規則。
步驟 2:設定您的 Active Directory 網域控制站
Active Directory 網域控制站提供身分驗證和 HPC 環境的集中式資源管理,其為安裝的必要項目。若要設定您的 Active Directory,請啟動執行個體做為您 HPC 叢集的網域控制站並設定它。
啟動您 HPC 叢集的網域控制站
-
在 https://console.aws.amazon.com/ec2/
開啟 Amazon EC2 主控台。 -
在主控台儀表板上,選擇 Launch Instance (啟動執行個體)。
-
在 Choose an AMI (選取 AMI) 頁面上,選取一個 Windows Server AMI,然後選取 Select (選取)。
-
在精靈的下一個頁面上,選取執行個體類型,然後選取 Next: Configure Instance Details (下一步:設定執行個體詳細資訊)。
-
在 Configure Instance Details (設定執行個體詳細資訊) 頁面上,從 Network (網路) 選取您的 VPC,並從 Subnet (子網) 選取子網。在精靈的下一個頁面上,您可以指定您執行個體的額外儲存體。
-
在 Add Tags (新增標籤) 頁面上,輸入
Domain Controller
做為執行個體Name
標籤的值,然後選擇 Next: Configure Security Group (下一步:設定安全群組)。 -
在 Configure Security Group (設定安全群組) 頁面上,選取 Select an existing security group (選取現有安全群組),選取
SG - Domain Controller
安全群組,然後選取 Review and Launch (檢閱和啟動)。 -
選擇 Launch (啟動)。
-
在導覽窗格中,選擇 Elastic IPs (彈性 IP)。
-
選擇 Allocate new address (配置新地址)。選擇 Allocate (配置)。選擇 Close (關閉)。
-
選取您建立的彈性 IP 地址,然後選取 Actions (動作)、Associate address (關聯地址)。針對 Instance (執行個體),選擇網域控制站執行個體。選擇 Associate (關聯)。
連線到您建立的執行個體,然後將伺服器設定為 HPC 叢集的網域控制站。
將您的執行個體設定為網域控制站
-
連線到您的
Domain Controller
執行個體。如需詳細資訊,請參閱連線至您的 Windows 執行個體。 -
開啟 Server Manager (伺服器管理員),然後新增 Active Directory Domain Services 角色。
-
使用伺服器管理員,或執行 DCPromo.exe 將伺服器提升為網域控制站。
-
在新的樹系中建立新的網域。
-
輸入
hpc.local
做為完整網域名稱 (FQDN)。 -
選取 Forest Functional Level (樹系功能層級) 做為 Windows Server 2008 R2。
-
確認 DNS Server (DNS 伺服器) 選項已選取,然後選取 Next (下一步)。
-
選取 Yes, the computer will use an IP address automatically assigned by a DHCP server (not recommended) (是,電腦會使用由 DHCP 伺服器自動指派的 IP 地址 (不建議))。
-
出現提示時,請選擇 Yes (是) 以繼續。
-
完成精靈,然後選取 Reboot on Completion (完成時重新開機)。
-
以
hpc.local\administrator
連線到執行個體。 -
建立網域使用者
hpc.local\hpcuser
。
步驟 3:設定您的前端節點
HPC 用戶端會連線到前端節點。前端節點會協助已排程任務。您透過啟動執行個體設定您的前端節點、安裝 HPC 套件,並設定叢集。
啟動執行個體,然後將其設定為 hpc.local
網域的成員並具有必要的使用者帳戶。
將執行個體設定為您的前端節點
-
啟動執行個體,將其命名為
HPC-Head
。當您啟動執行個體時,選取這些安全群組:SG - Windows HPC 叢集和 SG - 網域成員。 -
連線到執行個體,使用下列命令取得現有的 DNS 伺服器地址:
IPConfig /all
-
更新
HPC-Head
NIC 的 TCP/IPv4 屬性,使其包含Domain Controller
執行個體的彈性 IP 地址做為主要 DNS,然後新增先前步驟中的額外 DNS IP 地址。 -
使用
hpc.local
(網域管理員帳戶) 的登入資料,將電腦加入hpc.local\administrator
網域。 -
新增
hpc.local\hpcuser
為本機管理員。出現提示要求登入資料時,使用hpc.local\administrator
,然後重新啟動執行個體。 -
以
hpc.local\hpcuser
身分連線至 HPC-Head。
安裝 HPC 套件
-
使用
hpc.local\hpcuser
帳戶連線至您的 HPC-Head 執行個體。 -
使用 Server Manager (伺服器管理員),關閉管理員的 Internet Explorer 增強式安全性組態 (IE ESC)。
-
在 Server Manager (伺服器管理員) 中,於 Security Information (安全資訊) 下方,選擇 Configure IE ESC (設定 IE ESC)。
-
關閉管理員的 IE ESC。
-
-
在 HPC-Head 上安裝 HPC 套件。
-
從 Microsoft Download Center
將 HPC 套件下載到 HPC-Head
。選擇HPC-Head
上 Windows Server 版本的 HPC 套件。 -
將檔案解壓縮到資料夾,開啟資料夾並按兩下 setup.exe。
-
在安裝頁面上,選取 Create a new HPC cluster by creating a head node (建立前端節點以建立新的 HPC 叢集),然後選取 Next (下一步)。
-
接受預設設定,在前端節點上安裝所有資料庫,然後選擇 Next (下一步)。
-
完成協助程式。
-
在前端節點上設定您的 HPC 叢集
-
啟動 HPC Cluster Manager (HPC 叢集管理員)。
-
在 Deployment To-Do List (部署待辦事項) 中,選取 Configure your network (設定您的網路)。
-
在精靈中,選取預設選項 (5),然後選取 Next (下一步)。
-
完成精靈並在所有畫面上接受預設值,然後選擇您希望更新伺服器和參與客戶回函的方式。
-
請選擇 Configure (設定)。
-
選取 Provide Network Credentials (提供網路登入資料),然後提供
hpc.local\hpcuser
登入資料。選取 Configure the naming of new nodes (設定新節點的命名),然後選取 OK (確認)。
選取 Create a node template (建立節點範本)。
選取 Compute node template (運算節點範本),然後選取 Next (下一步)。
選取 Without operating system (無作業系統),然後使用預設值繼續。
選擇 Create (建立)。
步驟 4:設定運算節點
您透過啟動執行個體設定運算節點、安裝 HPC 套件,然後將節點新增到您的叢集。
首先,啟動執行個體,然後將其設定為 hpc.local
網域的成員並具有必要的使用者帳戶。
將執行個體設定為您的運算節點
-
啟動執行個體,將其命名為
HPC-Compute
。當您啟動執行個體時,選取這些安全群組:SG - Windows HPC Cluster (SG - Windows HPC 叢集) 和 SG - Domain Member (SG - 網域成員)。 -
登入執行個體,使用下列命令從 HPC-Compute 取得現有 DNS 伺服器地址:
IPConfig /all
-
更新
HPC-Compute
NIC 的 TCP/IPv4 屬性,使其包含Domain Controller
執行個體的彈性 IP 地址做為主要 DNS。然後新增先前步驟中的額外 DNS IP 地址。 -
使用
hpc.local
(網域管理員帳戶) 的登入資料,將電腦加入hpc.local\administrator
網域。 -
新增
hpc.local\hpcuser
為本機管理員。出現提示要求登入資料時,使用hpc.local\administrator
,然後重新啟動。 -
以
HPC-Compute
連線到hpc.local\hpcuser
。
在運算節點上安裝 HPC 套件
-
使用
HPC-Compute
帳戶連線到您的hpc.local\hpcuser
執行個體。 -
使用 Server Manager (伺服器管理員),關閉管理員的 Internet Explorer 增強式安全性組態 (IE ESC)。
-
在 Server Manager (伺服器管理員) 中,於 Security Information (安全資訊) 下方,選擇 Configure IE ESC (設定 IE ESC)。
-
關閉管理員的 IE ESC。
-
-
在
HPC-Compute
上安裝 HPC 套件。-
從 Microsoft Download Center
將 HPC 套件下載到 HPC-Compute
。選擇HPC-Compute
上 Windows Server 版本的 HPC 套件。 -
將檔案解壓縮到資料夾,開啟資料夾並按兩下 setup.exe。
-
在 Installation (安裝) 頁面上,選取 Join an existing HPC cluster by creating a new compute node (建立新的運算節點以加入現有的 HPC 叢集),然後選取 Next (下一步)。
-
指定
HPC-Head
執行個體的完整名稱,然後選擇預設值。 -
完成協助程式。
-
若要完成您的叢集組態,請從前端節點,將運算節點新增到您的叢集。
將運算節點新增到您的叢集
-
以
hpc.local\hpcuser
連線到HPC-Head
執行個體。 -
開啟 HPC Cluster Manager (HPC 叢集管理員)。
-
選取 Node Management (節點管理)。
-
若運算節點顯示在 Unapproved (未核准) 儲存貯體中,請以滑鼠右鍵按一下列出的節點,然後選取 Add Node (新增節點)。
-
選取 Add compute nodes or broker nodes that have already been configured (新增已設定的運算節點或代理節點)。
-
選取節點旁的核取方塊,然後選取 Add (新增)。
-
-
在節點上按一下滑鼠右鍵,然後選擇 Bring Online (上線)。
步驟 5:擴展您的 HPC 運算節點 (選擇性)
擴展您的運算節點
以
hpc.local\hpcuser
連線到HPC-Compute
執行個體。刪除任何您從 HP 套件安裝套件本機下載的檔案。(您已執行安裝程式並在您的映像上建立這些檔案,因此不需要為 AMI 進行複製。)
從
C:\Program Files\Amazon\Ec2ConfigService
開啟sysprep2008.xml
檔案。在
<settings pass="specialize">
的底部,新增下列區段。確認取代 hpc.local、password 和 hpcuser 以符合您的環境。<component name="Microsoft-Windows-UnattendedJoin" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Identification> <UnsecureJoin>false</UnsecureJoin> <Credentials> <Domain>
hpc.local
</Domain> <Password>password
</Password> <Username>hpcuser
</Username> </Credentials> <JoinDomain>hpc.local
</JoinDomain> </Identification> </component>-
儲存
sysprep2008.xml
。 -
選擇 Start (開始)、All Programs (所有程式)、EC2ConfigService Settings (EC2ConfigService 設定)。
選擇 General (一般) 標籤,然後清除 Set Computer Name (設定電腦名稱) 核取方塊。
選擇 Bundle 標籤,然後選擇 Run Sysprep and Shutdown Now (執行 Sysprep 並立即關機)。
開啟 Amazon EC2 主控台。
在導覽窗格中,選擇 Instances (執行個體)。
等待執行個體狀態顯示為「stopped (已停止)」。
選取執行個體並選取「Actions (動作)」、「Image and templates (映像和範本)」、「Create image (建立映像)」。
-
指定映像名稱和映像描述,然後選擇「Create Image (建立映像)」以從執行個體建立 AMI。
-
啟動原先關機的
HPC-Compute
執行個體。 -
使用
hpc.local\hpcuser
帳戶連線到前端節點。 -
從 HPC Cluster Manager (HPC 叢集管理員),刪除現在顯示為錯誤狀態的舊節點。
-
在 Amazon EC2 主控台的導覽窗格中,選擇 AMIs。
-
使用您建立的 AMI 將額外節點新增到叢集。
您可以從您建立的 AMI 啟動額外的運算節點。這些節點會自動加入網域,但您必須在 HPC Cluster Manager (HPC 叢集管理員) 中使用前端節點將它們做為已設定節點新增到叢集,並將它們上線。